D1 mini
Tiny ESP8266 dev board
To flash micropython
https://micropython.org/download#esp8266
might have to erase the flash first
esptool.py --port /dev/ttyUSB0 --baud 460800 erase_flash
flash:
esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 esp8266*.bin
transferring files
pip install adafruit-ampy
ampy --port=/dev/ttyUSB0 get /boot.py boot.py
neopixels
import machine, neopixel
def
test (i):
np = neopixel.NeoPixel(machine.Pin(i), 8)
np[0] = (255, 0, 0)
np.write()
http
https://github.com/fadushin/esp8266/tree/master/micropython/uhttpd
wifi
https://docs.micropython.org/en/latest/esp8266/quickref.html#networking
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('essid', 'password') # connect to an AP
wlan.config('mac') # get the interface's MAC adddress
wlan.ifconfig() # get the interface's IP/netmask/gw/DNS addresses
ap = network.WLAN(network.AP_IF) # create access-point interface
ap.active(True) # activate the interface
ap.config(essid='ESP-AP') # set the ESSID of the access point
Share this post
Twitter
Facebook
Reddit
LinkedIn
StumbleUpon
Pinterest
Email