This video show how to install Thonny and esptool on Ubuntu 20.04, to flash MicroPython firmware for ESP32.
Basically, install with command:
$ sudo apt install python3-pip
$ pip3 install esptool
$ sudo pip3 install thonny
$ sudo apt install python3-tk
Download microPython firmware for SP32:
esp32-idf3-20200805-unstable-v1.12-663-g9883d8e81.bin is used here.
Also add permission to user to access the USB port:
$ sudo usermod -a -G dialout <user>
$ sudo chmod a+rw <port>
Run Thonny:
$ thonny
Select MicroPython for ESP32:
Tools > Options... > Interpreter > (or Run > Select interpreter)
> Select MicroPython (ESP32) from the drop-down list.
My first MicroPython script run on ESP32:
from machine import Pin
from time import sleep
led = Pin(2, Pin.OUT)
while True:
led.value(1)
sleep(0.4)
led.value(0)
sleep(0.4)
led.value(1)
sleep(0.4)
led.value(0)
sleep(0.4)
led.value(1)
sleep(0.4)
led.value(0)
sleep(2.0)
Useful links:Related:
More ESP32/MicroPython exercises:
Very Good and simple to follow. Thank you very much!
ReplyDelete