- Check if device is present. This link is describing connecting and flashing Nodemcu.
- For connecting you can use picocom tool. So we have to install it.
sudo apt-get install -y picocom
- Type this command for connecting to Nodemcu. Check your device tty path.
picocom -b 115200 --flow n /dev/tty.SLAB_USBtoUART
-
After succesffully connecting you should see information header and python prompt
>>>. Now you can type MicroPython commands. -
On MacOS you can use for connect this command. On some pc with usb-c you could se device like
ls /dev/cu.*
screen /dev/tty.SLAB_USBtoUART 115200
Tip: For exit picocom type ctrl-a and ctrl-q.
- For loading we will use ampy tool. So we have to install it. On some Linux or Mac OSX systems you might need to install as root with sudo.
pip install adafruit-ampy
- For useful information you might type:
ampy --help
-
After type
ampy -p /dev/tty.SLAB_USBtoUART lswe can notice that in nodemcu isboot.pyfile. Nodemcu after connect power for first run this file and after runmain.py(if is present). -
Now we can put some script to device.
ampy -p /dev/tty.SLAB_USBtoUART put main.py
- If we want immediately run some script from Nodemcu with output we might type:
ampy -p /dev/tty.SLAB_USBtoUART run main.py
Tip: My the best way for debugging scripts was loading script/s to device (without side effect running yourself) via ampy
and then connect to device via picocom and run code in MicroPython prompt etc. import main, run_debug().
For created this manual I was inspirated by this page https://naucse.python.cz/
