Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: no module named 'UART #67

Open
mohamadnoor991 opened this issue Apr 19, 2021 · 3 comments
Open

ImportError: no module named 'UART #67

mohamadnoor991 opened this issue Apr 19, 2021 · 3 comments

Comments

@mohamadnoor991
Copy link

Hello, i have Xbee3 on the XBee grove board, when I am trying to execute some code I have an error about "ImportError: no module named 'UART".
How I can use new modules on Xbee3 ?
Should I upload these modules and how?
i need a quick answer please to start the execute my code.
Thanks

@SWoto
Copy link
Contributor

SWoto commented Apr 27, 2021

It's probably due to XBee3 having no secondary UART interface, only primary UART, so you have limitations.

image

You probably need to go here:
image

Digi MicroPython

@mohamadnoor991
Copy link
Author

@SWoto
Thank you, my friend yes this is the problem.
but if you have any idea about how I can connect the xbee3 module on XBee grove THT with ESP32 to communicate and send data between them?
Thanks for your answer.

@SWoto
Copy link
Contributor

SWoto commented Apr 28, 2021

You can use the side pins, this way you will be able to use normal jumpers to connect XBee's primary UART to ESP32 UART.
image

The connection need is:

02 DOUT -> ESP32 RX
03 DIN  -> ESP32 TX

You'll be able to send messages with something like the code below:

from sys import stdin, stdout
import time

def receive_data():
    data = stdin.buffer.readline()
    return data

def write_data(data_out):
    stdout.write(bytearray(data_out))

data_out = 'Hello World from Cellular'
complement_data_in = 'XBee Received from ESP32: '

time.sleep(1)
write_data(data_out)

while True:
    data = receive_data()
    if data is not None:
        time.sleep(.1)
        write_data(complement_data_in+data.decode('acii'))
        time.sleep(1)

Also, avoid using USB and primaryUART together, I'd some problems with it because USB data gets send to my other board and my other board data goest to the computer too, so it gets messy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants