The cross-compile will only compile that .py file. If you’re using modules outside of the embedded modules on the XBee 3 firmware, you need to upload them as well.
That said, you probably won’t be able to use the XBeeDevice class from digi.xbee.devices. Look at the MicroPython support documentation for the XBee3 or this repository of sample modules and programs: https://github.com/digidotcom/xbee-micropython
MicroPython does not contain all the same modules you’re used to in CPython. Your error means there is no digi module.
You can get a list of modules by running (this is in firmware 1008):
>>> help(‘modules’) main io time uos
array json ubinascii ustruct
binascii machine uerrno utime
builtins micropython uhashlib xbee
errno os uio
gc struct ujson
hashlib sys umachine
You see no “digi” listed but there is “xbee”. You can see what xbee contains using this command:
The MicroPython xbee module is far more limited than the CPython xbee module. You can find documentation by searching the web for “MicroPython programming guide 90002219” then check the “XBee module” section. I recommend reading through a lot of the guide for basic information.
What is the solution for that? how I can use Cpython module with Micropython?
i need to use UART module fro example with xbee3 but I always have this message error “ImportError: no module named ‘UART’”
Compiling on device takes a few minutes, but I’ve found it to be very helpful especially when dealing with buffering/limited memory available on the device.
I would use the uPython terminal through XCTU, and try your code with Ctrl-E, paste your code, then Ctrl-D to run. See if that functions. If it does, use the same process but with CTRL-F to compile on the device.
if you need uart use the machine library as in from machine import UART
Make sure your XBee3 module is updated with the latest firmware. You can try using the File Manager from XCTU to upload files to the module. If you’re still having trouble, can you reply with which XBee3 firmware you’re using, and which version of the PyCharm plugin you have?