• Wire – The ESP8266 should work with any I2C sensor you can throw at it – just use the
same Wire API calls you’re used to. There are a few differences:
• Pin definition: The ESP2866 doesn’t actually have any hardware I2C pins –
those labeled on the Thing are the default, but you can actually use any two pins
as SDA and SCL. Calling Wire.begin() will assume pins 2 and 14 are SDA and
SCL, but you can manually set them to any other pin by
calling Wire.begin([SDA], [SCL]).
• SPI – The ESP8266 Thing can control an SPI bus using function calls made standard
by the Arduino SPI library.
• An additional function to set the frequency – SPI.setFrequency([frequency]) – is
added. You may need to call that in your setup to slow the clock down from its
default value. For example, SPI.setFrequency(1000000) will set the SPI clock to
1MHz.
• The MISO, MOSI, and SCLK SPI pins are hard-coded and can’t be moved, they
are:
Pin
Number
SPI
Function
12 MISO
13 MOSI
14 (SCL) SCLK
15 CS
Using the Serial Monitor
GPIO0 – while perfectly capable as a digital I/O – serves a secondary purpose as a
bootload/run-mode controller. When the ESP8266 boots up, it looks at GPIO0’s value to
either enter the bootloader or start running the current program:
GPIO0 Value
ESP8266
Mode
HIGH (3.3V) Run Program
LOW (0V) Bootloader
To make it easy to program the ESP8266, we’ve tied GPIO0 to DTR (along with RST). When
your programmer begins to upload a sketch, it’ll pull DTR low, in turn setting GPIO0 low and
making the ESP8266 enter bootloader mode.
Unfortunately, when you open a serial terminal, DTR usually goes low again. So every time
you open the Arduino serial monitor, it’ll cause the ESP8266 to enter bootloader mode,
instead of run-program mode. If you open up the serial monitor, and all you see is a line of
gibberish, you’ve probably booted the ESP8266 into bootloader mode.
There are a few ways around this. We’ve added the DTR jumper on the bottom of the board.
You can cut the trace on the back and install a 2-pin male header combined with a 2-pin
jumper. If the jumper is present, the board will be able to be programmed. Removing the
jumper will enable serial terminal mode.