All examples are for Wemos D1 Mini, WS2812B RGB Shield (NeoPixel) and DHT Pro Shield.
- Python knowledge
- Micro USB cable
- Python 3 installed
- Python IDE installed
- Git client (optional)
- Connect to internet
- Install serial terminal
- Windows: Putty
- Linux, Mac: Use screen tool
- Install ampy, install instruction
- Add ampy to PATH
- Install drivers for CH340 (Mac, Windows < 8.1)
Baudrate: 115200
Control LED on ESP8266 chip. LED is connected on pin 2 to VCC. You control ground (0 - on, 1 - off).
import machine
pin = machine.Pin(2, machine.Pin.OUT)
pin.value(0)
pin.value(1)
Scrip name: 101.py
Close interactive prompt
Example for Windows. Use your serial port number.
ampy --port COM14 run 101.py
Example for Linux and Mac. Do not forget to use full path to your serial port.
ampy --port /dev/ttyUSB0 run 101.py
Startup scripts
- boot.py
- main.py - runs automatically after start
ampy --port COM4 put main.py
ampy --port /dev/ttyUSB0 put main.py
Using hardware drivers
How it works with pins
Read temperature and humidity dht.py
What is it Neopixel LED and how it works
Control Neopixel RGB LED neopixel.py
Create simple thermometer using RGB LED and DHT11 - temperature is showed using colors (for example red hot, blue cold)
How it works
GET vs POST
HTTP Headers
SSL
Explain Wi-Fi modes - access point vs. client
Connect to local Wi-Fi wifi_connect.py
Download website http_test.py Connect to Wi-Fi first!
Create ThingSpeak Account
Create Channel
Send data from DHT11 to channel
Run this code to find mac address of your board.
import network
wlan = network.WLAN(network.STA_IF) # create station interface
wlan.active(True) # activate the interface
print(":".join(map(lambda x: "%02x" % x, wlan.config('mac'))))
Open list of available Wi-Fi and connect to Wi-Fi named MicroPython-xxxxxx where xxxxxx is part of MAC address. Password is micropythoN. IP addres of board is 192.168.4.1.
Create simple web server showing current temperature
Crete web server controlling RGB light
Windows: NodeMCU Flasher
pip install esptool
python c:\Python34\Scripts\esptool.py --port COM7 erase_flash
python c:\Python34\Scripts\esptool.py --port COM7 write_flash -fm dio 0x000000 esp8266-20170823-v1.9.2.bin