Skip to content

Instantly share code, notes, and snippets.

@Bouni
Created January 10, 2020 18:52
Show Gist options
  • Save Bouni/d9742e60ee5334bed55233c783e47b29 to your computer and use it in GitHub Desktop.
Save Bouni/d9742e60ee5334bed55233c783e47b29 to your computer and use it in GitHub Desktop.
Micropython
# install packages
yay -S esptool
sudo pip install rshell
# flash micropython
- Download: https://micropython.org/download#esp32 (GENERIC : esp32-idf3-20200110-v1.12-45-gbfbd94401.bin)
- Erase flash: esptool.py --port /dev/ttyUSB0 erase_flash
- Flash firmware: esptool.py --chip esp32 --port /dev/ttyUSB0 --baud 460800 write_flash -z 0x1000 <esp32-....bin>
# REPL
rshell --buffer-size=30 -p /dev/ttyUSB0
# copy files onto the ESP32 via rshell
cp myfile.py /pyboard
# run file
repl
import myfile
#WIFI
import network
wlan = network.WLAN(network.STA_IF) # create station interface
wlan.active(True) # activate the interface
wlan.scan() # scan for access points
wlan.isconnected() # check if the station is connected to an AP
wlan.connect('WIFI', 'PASSWORD') # connect to an AP
print(wlan.config('mac')) # get the interface's MAC address
#wlan.ifconfig() # get the interface's IP/netmask/gw/DNS addresses
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment