Skip to content

Latest commit

 

History

History
57 lines (41 loc) · 1.94 KB

File metadata and controls

57 lines (41 loc) · 1.94 KB

Deploy MicroPython scripts to Nodemcu(ESP8266)

nodemcu

Control

  • Check if device is present. This link is describing connecting and flashing Nodemcu.

Connect

  • 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.

Load scripts

  • 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 ls we can notice that in nodemcu is boot.py file. Nodemcu after connect power for first run this file and after run main.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().

Inspiration

For created this manual I was inspirated by this page https://naucse.python.cz/