esp8266 - blavery.com · pin numbering 1) the “d0, d1 ...” pins are digital in/out....

13
ESP8266 An arduino variant

Upload: others

Post on 05-Oct-2019

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ESP8266 - blavery.com · 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

ESP8266An arduino variant

Page 2: ESP8266 - blavery.com · 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

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

Page 3: ESP8266 - blavery.com · 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

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.

Page 4: ESP8266 - blavery.com · 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

Need to install a “new board”ie the esp8266

as a variant arduino

Page 5: ESP8266 - blavery.com · 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

Tools / Board / Board Manager

Page 6: ESP8266 - blavery.com · 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

Find the new ESP8266 entry and click “INSTALL”.New board profile is downloaded from internet. It will take a little while.

Page 7: ESP8266 - blavery.com · 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

You now have ESP8266 boards

listed

The closest to ours is NodeMCU 1.0

Page 8: ESP8266 - blavery.com · 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

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)

Page 9: ESP8266 - blavery.com · 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

4 Buttons

Gnd

But1 to “D7”But2 to “D8”But3 to “D5”But4 to “D6”

Page 10: ESP8266 - blavery.com · 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

RGB LED

Gnd G to “D0” B to “D1” R to “D2”

Page 11: ESP8266 - blavery.com · 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

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!

Page 12: ESP8266 - blavery.com · 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

Sketches

ERC.ino – ESP8266 Remote Control-- a clone of arduino DRC

esp86oled.ini – basic oled demo

Page 13: ESP8266 - blavery.com · 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