esp8266 - blavery.com · pin numbering 1) the “d0, d1 ...” pins are digital in/out....
TRANSCRIPT
ESP8266An arduino variant
GPIOs
D0 16 green led
D1 5 blue led
D2 4 red led
D3 0 inbuilt butn / OLED sda
D4 2 inbuilt led / OLED scl
D5 14 but 3
D6 12 but 4
D7 13 but 1
D8 15 but 2
A0 Analog
Pin numbering
1) The “D0, D1 ...” pins are digital in/out. Unfortunately these are not the real GPIO numbers of the CPU. For today’s sketches we need to cross-reference those D numbers to real GPIO numbers.
2) There are many pins on the module that are not really useful/available to us. Eg the S pins and TX/RX pins.
3) A0 is the one analog in pin. 0.0 to 3.3 volts.
Need to install a “new board”ie the esp8266
as a variant arduino
Tools / Board / Board Manager
Find the new ESP8266 entry and click “INSTALL”.New board profile is downloaded from internet. It will take a little while.
You now have ESP8266 boards
listed
The closest to ours is NodeMCU 1.0
The “inbuilt” GPIO items:
A LED (near the antenna) using GPIO-02(ie D4)
A “flash” button using GPIO-00(ie “D3”)
(There is also a “reset” button)
4 Buttons
Gnd
But1 to “D7”But2 to “D8”But3 to “D5”But4 to “D6”
RGB LED
Gnd G to “D0” B to “D1” R to “D2”
OLED Display
Gnd 3V SDA to “D3” SCL to “D4”
D3 and D4 are the inbuilt button & LED.
The D3 & D4 connections fortunately allow us to apply double duties to those pins.
Of course, I2C (to the oled) will wink the LED, and pressing the button will disrupt I2C messages!
Sketches
ERC.ino – ESP8266 Remote Control-- a clone of arduino DRC
esp86oled.ini – basic oled demo