ESPresso Lite 1.0 (beta version) is an Arduino-compatible Wi-Fi development board powered by Espressif System's own ESP8266 WROOM-02 module. It has breadboard-friendly breakout pins with in-built LED, two reset/flash buttons and a user programmable button . The operating voltage is 3.3VDC, regulated with 800mA maximum current. Special distinctive features include on-board I2C pads that allow direct connection to OLED LCD and sensor boards.
+
+
ESPresso Lite 2.0
+
+
ESPresso Lite 2.0 is an Arduino-compatible Wi-Fi development board based on an earlier V1 (beta version). Re-designed together with Cytron Technologies, the newly-revised ESPresso Lite V2.0 features the auto-load/auto-program function, eliminating the previous need to reset the board manually before flashing a new program. It also feature two user programmable side buttons and a reset button. The special distinctive features of on-board pads for I2C sensor and actuator is retained.
+
+
NodeMCU 0.9
+
+
Pin mapping
+
+
Pin numbers written on the board itself do not correspond to ESP8266 GPIO pin numbers. Constants are defined to make using this board easier:
If you want to use NodeMCU pin 5, use D5 for pin number, and it will be translated to 'real' GPIO pin 14.
+
+
NodeMCU 1.0
+
+
This module is sold under many names for around $6.50 on AliExpress and it's one of the cheapest, fully integrated ESP8266 solutions.
+
+
It's an open hardware design with an ESP-12E core and 4 MB of SPI flash.
+
+
Acording to the manufacturer, "with a micro USB cable, you can connect NodeMCU devkit to your laptop and flash it without any trouble". This is more or less true: the board comes with a CP2102 onboard USB to serial adapter which just works, well, the majority of the time. Sometimes flashing fails and you have to reset the board by holding down FLASH + RST, then releasing FLASH, then releasing RST. This forces the CP2102 device to power cycle and to be re-numbered by Linux.
+
+
The board also features a NCP1117 voltage regulator, a blue LED on GPIO16 and a 220k/100k Ohm voltage divider on the ADC input pin.
This board comes with 2 MB of SPI flash and optional accessories (e.g. evaluation board ESP8266-EVB or BAT-BOX for batteries).
+
+
The basic module has three solder jumpers that allow you to switch the operating mode between SDIO, UART and FLASH.
+
+
The board is shipped for FLASH operation mode, with jumpers TD0JP=0, IO0JP=1, IO2JP=1.
+
+
Since jumper IO0JP is tied to GPIO0, which is PIN 21, you'll have to ground it before programming with a USB to serial adapter and reset the board by power cycling it.
+
+
UART pins for programming and serial I/O are GPIO1 (TXD, pin 3) and GPIO3 (RXD, pin 4).
This is a stripped down version of the above. Behaves identically in terms of jumpers but has less pins readily available for I/O. Still 2 MB of SPI flash.
+
+
Olimex ESP8266-EVB
+
+
It's a Olimex MOD-WIFI-ESP8266-DEV module installed on the headers of a development board which features some breakout connectors, a button (GPIO0) and a relay (GPIO5).
+
+
Programming is pretty straightforward: the board is supported in the Arduino IDE after installing it via the Board Manager. To download a program you just have to connect GND/RX/TX from a serial/USB adapter to the UEXT connector and press the only button before applying power to enter UART mode.
+
+
Don't connect 5V from the serial/USB adapter to the board or you won't be able to power cycle it for UART mode.
This guide is also useful for the first setup, since it contains the UEXT connector pinout.
+
+
Board variants include:
+ * ESP8266-EVB-BAT: comes with built-in LiPo charger and step-up converter
+ * ESP8266-EVB-BAT-BOX: as above, but enclosd in a plastic box (non-weatherproof)
ESPino integrates the ESP-12 module with a 3.3v regulator, CP2104 USB-Serial bridge and a micro USB connector for easy programming. It is designed for fitting in a breadboard and has an RGB Led and two buttons for easy prototyping.
+
+
For more information about the hardware, pinout diagram and programming procedures, please see the datasheet.
WifInfo integrates the ESP-12 or ESP-07+Ext antenna module with a 3.3v regulator and the hardware to be able to measure French telemetry issue from ERDF powering meter serial output. It has a USB connector for powering, an RGB WS2812 Led, 4 pins I2C connector to fit OLED or sensor, and two buttons + FTDI connector and auto reset feature.
+
+
For more information, please see WifInfo related blog entries, github and community forum.
+
+
Generic ESP8266 modules
+
+
These modules come in different form factors and pinouts. See the page at ESP8266 community wiki for more info:
+ESP8266 Module Family.
+
+
Usually these modules have no bootstapping resistors on board, insufficient decoupling capacitors, no voltage regulator, no reset circuit, and no USB-serial adapter. This makes using them somewhat tricky, compared to development boards which add these features.
+
+
In order to use these modules, make sure to observe the following:
+
+
+
Provide sufficient power to the module. For stable use of the ESP8266 a power supply with 3.3V and >= 250mA is required. Using the power available from USB to Serial adapter is not recommended, these adapters typically do not supply enough current to run ESP8266 reliably in every situation. An external supply or regulator along with filtering capacitors is preferred.
+
Connect bootstapping resistors to GPIO0, GPIO2, GPIO15 according to the schematics below.
+
Put ESP8266 into bootloader mode before uploading code.
+
+
+
Serial Adapter
+
+
There are many different USB to Serial adapters / boards.
+To be able to put ESP8266 into bootloader mode using serial handshaking lines, you need the adapter which breaks out RTS and DTR outputs. CTS and DSR are not useful for upload (they are inputs). Make sure the adapter can work with 3.3V IO voltage: it should have a jumper or a switch to select between 5V and 3.3V, or be marked as 3.3V only.
+
+
Adapters based around the following ICs should work:
Reset is also named RSBT or REST (adding PullUp improves the stability of the module)
+
GPIO2 is alternative TX for the boot loader mode
+
Directly connecting a pin to VCC or GND is not a substitute for a PullUp or PullDown resistor, doing this can break upload management and the serial console, instability has also been noted in some cases.
+
+
+
+
ESP to Serial
+
+
+
+
Minimal Hardware Setup for Bootloading only
+
+
ESPxx Hardware
+
+
+
+
PIN
+
Resistor
+
Serial Adapter
+
+
+
+
VCC
+
+
VCC (3.3V)
+
+
+
GND
+
+
GND
+
+
+
TX or GPIO2
+
+
RX
+
+
+
RX
+
+
TX
+
+
+
GPIO0
+
+
GND
+
+
+
Reset
+
+
RTS*
+
+
+
GPIO15
+
PullDown
+
+
+
+
CH_PD
+
PullUp
+
+
+
+
+
+
Note
+
+
+
if no RTS is used a manual power toggle is needed
+
+
+
+
Minimal Hardware Setup for Running only
+
+
ESPxx Hardware
+
+
+
+
PIN
+
Resistor
+
Power supply
+
+
+
+
VCC
+
+
VCC (3.3V)
+
+
+
GND
+
+
GND
+
+
+
GPIO0
+
PullUp
+
+
+
+
GPIO15
+
PullDown
+
+
+
+
CH_PD
+
PullUp
+
+
+
+
+
Minimal
+
+
+
+
Improved Stability
+
+
+
+
Boot Messages and Modes
+
+
The ESP module checks at every boot the Pins 0, 2 and 15.
+based on them its boots in different modes:
+
+
+
+
GPIO15
+
GPIO0
+
GPIO2
+
Mode
+
+
+
+
0V
+
0V
+
3.3V
+
Uart Bootloader
+
+
+
0V
+
3.3V
+
3.3V
+
Boot sketch (SPI flash)
+
+
+
3.3V
+
x
+
x
+
SDIO mode (not used for Arduino)
+
+
+
+
at startup the ESP prints out the current boot mode example:
+
+rst cause:2, boot mode:(3,6)
+
+
+
note:
+ - GPIO2 is used as TX output and the internal Pullup is enabled on boot.
+
+
rst cause
+
+
+
+
Number
+
Description
+
+
+
+
0
+
unknown
+
+
+
1
+
normal boot
+
+
+
2
+
reset pin
+
+
+
3
+
software reset
+
+
+
4
+
watchdog reset
+
+
+
+
boot mode
+
+
the first value respects the pin setup of the Pins 0, 2 and 15.
I2C library updated to better handle repeated start for certain devices,
+improved waveforms, higher frequencies for 160MHz core clock, fix case where
+using different pins would not work with libs calling begin internally.
+
Add Adafruit HUZZAH board
+
Add SparkFun Thing board
+
Add SweetPea ESP-210 board
+
Add eboot bootloader
+
Timer0 support
+
Add PWM range and frequency control
+
Add ESP.eraseConfig method
+
Fix pin change interrupt handling (#322)
+
Add SLC and I2S register definitions
+
Fix math functions calling themselves recursively (#233, #354)
Rebuild toolchain and esptool with support for OS X down to 10.6.
+
+
+
Libraries
+
+
+
Better connection handling in ESP8266WebServer.
+The server now sends Content-Length and Connection: close headers,
+then waits for the client to disconnect. By not closing the connection
+actively, server avoids TIME_WAIT TCP state, and TCP stack is able to
+release the memory immediately, without waiting for 2xMSL period.
+If the client doesn't disconnect in 2000ms, the server closes the connection
+actively.
+
Add Hash library, which has a function to calculate SHA1 hash.
+
SD, Adafruit_ILI9341, and OneWire libraries are now bundled.
+
Fix incorrect sector calculation in EEPROM library.
+
+
+
+
+
1.6.4-628-g545ffde
+
+
May 19, 2015
+
+
+
Initial release of Boards Manager package for ESP8266 platform.
+
+
+
+
+
diff --git a/versions/2.2.0-rc1/doc/eclipse/1_Install_New_Software.png b/versions/2.2.0-rc1/doc/eclipse/1_Install_New_Software.png
new file mode 100644
index 000000000..a3e9d3619
Binary files /dev/null and b/versions/2.2.0-rc1/doc/eclipse/1_Install_New_Software.png differ
diff --git a/versions/2.2.0-rc1/doc/eclipse/2_Install_software.png b/versions/2.2.0-rc1/doc/eclipse/2_Install_software.png
new file mode 100644
index 000000000..b7baadaa9
Binary files /dev/null and b/versions/2.2.0-rc1/doc/eclipse/2_Install_software.png differ
diff --git a/versions/2.2.0-rc1/doc/eclipse/eclipse.md b/versions/2.2.0-rc1/doc/eclipse/eclipse.md
new file mode 100644
index 000000000..348d1cf19
--- /dev/null
+++ b/versions/2.2.0-rc1/doc/eclipse/eclipse.md
@@ -0,0 +1,38 @@
+using Eclipse with Arduino ESP8266
+===========================================
+
+### What to Download ###
+- [arduino IDE](https://www.arduino.cc/en/Main/Software)
+- [Eclipse IDE for C/C++ Developers](http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/marsr)
+- [Java](http://www.java.com/)
+
+### Setup Arduino ###
+ see the [Readme](https://github.com/esp8266/Arduino#installing-with-boards-manager)
+
+### Setup Eclipse ###
+- [step 1](http://www.baeyens.it/eclipse/how_to.shtml#/c)
+- [step 2](http://www.baeyens.it/eclipse/how_to.shtml#/e)
+- go to Window --> preferences --> Arduino
+- add as private hardware path the Part to the ESP8266
+
+###### example private hardware path
+ Windows: C:\Users\[username]\AppData\Roaming\Arduino15\packages\esp8266\hardware
+ Linux: /home/[username]/.arduino15/packages/esp8266/hardware
+
+### Eclipse wont build ###
+if eclipse dont find the path to the Compiler add to the platform.txt
+after:
+```
+version=1.6.4
+```
+this:
+```
+runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}/../../../tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9
+runtime.tools.esptool.path={runtime.platform.path}/../../../tools/esptool/0.4.4
+```
+Note:
+ - the path may changed, check the current version.
+ - each update over the Arduino IDE will remove the fix
+ - may not needed in future if Eclipse Plugin get an Update
+
+
\ No newline at end of file
diff --git a/versions/2.2.0-rc1/doc/eclipse/makefile.init b/versions/2.2.0-rc1/doc/eclipse/makefile.init
new file mode 100644
index 000000000..76438d62c
--- /dev/null
+++ b/versions/2.2.0-rc1/doc/eclipse/makefile.init
@@ -0,0 +1,39 @@
+vecho := @echo
+Q := @
+
+PROJECT_NAME=project_name
+
+OTA_IP=192.168.254.100
+OTA_PORT=8266
+
+SERIAL_PORT=COM3
+SERIAL_BAUD=230400
+
+ARDUINO_BASE = D:/Coding/avr/Programme/arduino-nightly
+ESP8266_BASE = $(ARDUINO_BASE)/hardware/esp8266com/esp8266
+ESP8266_TOOLS = $(ESP8266_BASE)/tools
+XTENSA_TOOLS_ROOT = $(ESP8266_TOOLS)/xtensa-lx106-elf/bin
+
+PYTHON_BIN = python
+ESPTOOL_PY_BIN = $(ESP8266_TOOLS)/esptool.py
+ESPOTA_PY_BIN = $(ESP8266_TOOLS)/espota.py
+ESPTOOL_BIN = $(ESP8266_TOOLS)/esptool/esptool.exe
+
+ota:
+ $(vecho) ota...
+ $(PYTHON_BIN) $(ESPOTA_PY_BIN) -i $(OTA_IP) -p $(OTA_PORT) --auth= -f ./$(PROJECT_NAME).bin
+
+ota_spiffs:
+ $(vecho) ota spiffs...
+ $(PYTHON_BIN) $(ESPOTA_PY_BIN) -i $(OTA_IP) -p $(OTA_PORT) --auth= -s -f ./$(PROJECT_NAME)_spiffs.bin
+
+erase_flash:
+ $(vecho) "Erase Flash"
+ $(PYTHON_BIN) $(ESPTOOL_PY_BIN) -p $(SERIAL_PORT) -b $(SERIAL_BAUD) erase_flash
+
+dumpmem:
+ $(vecho) "Read Flash need some time..."
+ $(PYTHON_BIN) $(ESPTOOL_PY_BIN) -p $(SERIAL_PORT) -b $(SERIAL_BAUD) read_flash 0 4194304 dump.bin
+
+objdump:
+ "$(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-objdump" -S $(PROJECT_NAME).elf > $(PROJECT_NAME).dobj
diff --git a/versions/2.2.0-rc1/doc/esp12.png b/versions/2.2.0-rc1/doc/esp12.png
new file mode 100644
index 000000000..8ec371016
Binary files /dev/null and b/versions/2.2.0-rc1/doc/esp12.png differ
diff --git a/versions/2.2.0-rc1/doc/esp12.svg b/versions/2.2.0-rc1/doc/esp12.svg
new file mode 100644
index 000000000..107073dfa
--- /dev/null
+++ b/versions/2.2.0-rc1/doc/esp12.svg
@@ -0,0 +1,1187 @@
+
+
+
+
diff --git a/versions/2.2.0-rc1/doc/esp8266_tcp_active_close.png b/versions/2.2.0-rc1/doc/esp8266_tcp_active_close.png
new file mode 100644
index 000000000..f9dad0987
Binary files /dev/null and b/versions/2.2.0-rc1/doc/esp8266_tcp_active_close.png differ
diff --git a/versions/2.2.0-rc1/doc/exception_causes.md b/versions/2.2.0-rc1/doc/exception_causes.md
new file mode 100644
index 000000000..4b11bdb13
--- /dev/null
+++ b/versions/2.2.0-rc1/doc/exception_causes.md
@@ -0,0 +1,38 @@
+Exception Causes (EXCCAUSE)
+===========================================
+
+| EXC-CAUSE Code | Cause Name | Cause Description | Required Option | EXC-VADDR Loaded |
+|:--------------:|:---------------------------|:------------------------------------------------------------------------------------------------------------|:-------------------------|:----------------:|
+| 0 | IllegalInstructionCause | Illegal instruction | Exception | No |
+| 1 | SyscallCause | SYSCALL instruction | Exception | No |
+| 2 | InstructionFetchErrorCause | Processor internal physical address or data error during instruction fetch | Exception | Yes |
+| 3 | LoadStoreErrorCause | Processor internal physical address or data error during load or store | Exception | Yes |
+| 4 | Level1InterruptCause | Level-1 interrupt as indicated by set level-1 bits in the INTERRUPT register | Interrupt | No |
+| 5 | AllocaCause | MOVSP instruction, if callers registers are not in the register file | Windowed Register | No |
+| 6 | IntegerDivideByZeroCause | QUOS, QUOU, REMS, or REMU divisor operand is zero | 32-bit Integer Divide | No |
+| 7 | Reserved for Tensilica | | | |
+| 8 | PrivilegedCause | Attempt to execute a privileged operation when CRING ? 0 | MMU | No |
+| 9 | LoadStoreAlignmentCause | Load or store to an unaligned address | Unaligned Exception | Yes |
+| 10..11 | Reserved for Tensilica | | | |
+| 12 | InstrPIFDataErrorCause | PIF data error during instruction fetch | Processor Interface | Yes |
+| 13 | LoadStorePIFDataErrorCause | Synchronous PIF data error during LoadStore access | Processor Interface | Yes |
+| 14 | InstrPIFAddrErrorCause | PIF address error during instruction fetch | Processor Interface | Yes |
+| 15 | LoadStorePIFAddrErrorCause | Synchronous PIF address error during LoadStore access | Processor Interface | Yes |
+| 16 | InstTLBMissCause | Error during Instruction TLB refill | MMU | Yes |
+| 17 | InstTLBMultiHitCause | Multiple instruction TLB entries matched | MMU | Yes |
+| 18 | InstFetchPrivilegeCause | An instruction fetch referenced a virtual address at a ring level less than CRING | MMU | Yes |
+| 19 | Reserved for Tensilica | | | |
+| 20 | InstFetchProhibitedCause | An instruction fetch referenced a page mapped with an attribute that does not permit instruction fetch | Region Protection or MMU | Yes |
+| 21..23 | Reserved for Tensilica | | | |
+| 24 | LoadStoreTLBMissCause | Error during TLB refill for a load or store | MMU | Yes |
+| 25 | LoadStoreTLBMultiHitCause | Multiple TLB entries matched for a load or store | MMU | Yes |
+| 26 | LoadStorePrivilegeCause | A load or store referenced a virtual address at a ring level less than CRING | MMU | Yes |
+| 27 | Reserved for Tensilica | | | |
+| 28 | LoadProhibitedCause | A load referenced a page mapped with an attribute that does not permit loads | Region Protection or MMU | Yes |
+| 29 | StoreProhibitedCause | A store referenced a page mapped with an attribute that does not permit stores | Region Protection or MMU | Yes |
+| 30..31 | Reserved for Tensilica | | | |
+| 32..39 | CoprocessornDisabled | Coprocessor n instruction when cpn disabled. n varies 0..7 as the cause varies 32..39 | Coprocessor | No |
+| 40..63 | Reserved | | | |
+
+
+Infos from Xtensa Instruction Set Architecture (ISA) Reference Manual
\ No newline at end of file
diff --git a/versions/2.2.0-rc1/doc/filesystem.html b/versions/2.2.0-rc1/doc/filesystem.html
new file mode 100644
index 000000000..2715b6695
--- /dev/null
+++ b/versions/2.2.0-rc1/doc/filesystem.html
@@ -0,0 +1,587 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ File System · ESP8266 Arduino Core
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This documentation is for version 2.2.0-rc1. Other versions.
+
Even though file system is stored on the same flash chip as the program, programming new sketch will not modify file system contents. This allows to use file system to store sketch data, configuration files, or content for Web server.
+
+
The following diagram illustrates flash layout used in Arduino environment:
+
|--------------|-------|---------------|--|--|--|--|--|
+^ ^ ^ ^ ^
+Sketch OTA update File system EEPROM WiFi config (SDK)
+
+
File system size depends on the flash chip size. Depending on the board which is selected in IDE, you have the following options for flash size:
+
+
+
+
Board
+
Flash chip size, bytes
+
File system size, bytes
+
+
+
+
Generic module
+
512k
+
64k, 128k
+
+
+
Generic module
+
1M
+
64k, 128k, 256k, 512k
+
+
+
Generic module
+
2M
+
1M
+
+
+
Generic module
+
4M
+
3M
+
+
+
Adafruit HUZZAH
+
4M
+
1M, 3M
+
+
+
ESPresso Lite 1.0
+
4M
+
1M, 3M
+
+
+
ESPresso Lite 2.0
+
4M
+
1M, 3M
+
+
+
NodeMCU 0.9
+
4M
+
1M, 3M
+
+
+
NodeMCU 1.0
+
4M
+
1M, 3M
+
+
+
Olimex MOD-WIFI-ESP8266(-DEV)
+
2M
+
1M
+
+
+
SparkFun Thing
+
512k
+
64k
+
+
+
SweetPea ESP-210
+
4M
+
1M, 3M
+
+
+
WeMos D1 & D1 mini
+
4M
+
1M, 3M
+
+
+
ESPDuino
+
4M
+
1M, 3M
+
+
+
+
Note: to use any of file system functions in the sketch, add the following include to the sketch:
+
#include "FS.h"
+
+
Uploading files to file system
+
+
ESP8266FS is a tool which integrates into the Arduino IDE. It adds a menu item to Tools menu for uploading the contents of sketch data directory into ESP8266 flash file system.
In your Arduino sketchbook directory, create tools directory if it doesn't exist yet
+
Unpack the tool into tools directory (the path will look like <home_dir>/Arduino/tools/ESP8266FS/tool/esp8266fs.jar)
+
Restart Arduino IDE
+
Open a sketch (or create a new one and save it)
+
Go to sketch directory (choose Sketch > Show Sketch Folder)
+
Create a directory named data and any files you want in the file system there
+
Make sure you have selected a board, port, and closed Serial Monitor
+
Select Tools > ESP8266 Sketch Data Upload. This should start uploading the files into ESP8266 flash file system. When done, IDE status bar will display SPIFFS Image Uploaded message.
+
+
+
File system object (SPIFFS)
+
+
begin
+
SPIFFS.begin()
+
+
This method mounts SPIFFS file system. It must be called before any other
+FS APIs are used. Returns true if file system was mounted successfully, false
+otherwise.
+
+
format
+
SPIFFS.format()
+
+
Formats the file system. May be called either before or after calling begin.
+Returns true if formatting was successful.
+
+
open
+
SPIFFS.open(path,mode)
+
+
Opens a file. path should be an absolute path starting with a slash
+(e.g. /dir/filename.txt). mode is a string specifying access mode. It can be
+one of "r", "w", "a", "r+", "w+", "a+". Meaning of these modes is the same as
+for fopen C function.
+
r Open text file for reading. The stream is positioned at the
+ beginning of the file.
+
+ r+ Open for reading and writing. The stream is positioned at the
+ beginning of the file.
+
+ w Truncate file to zero length or create text file for writing.
+ The stream is positioned at the beginning of the file.
+
+ w+ Open for reading and writing. The file is created if it does
+ not exist, otherwise it is truncated. The stream is
+ positioned at the beginning of the file.
+
+ a Open for appending (writing at end of file). The file is
+ created if it does not exist. The stream is positioned at the
+ end of the file.
+
+ a+ Open for reading and appending (writing at end of file). The
+ file is created if it does not exist. The initial file
+ position for reading is at the beginning of the file, but
+ output is always appended to the end of the file.
+
+
Returns File object. To check whether the file was opened successfully, use
+the boolean operator.
+
Filef=SPIFFS.open("/f.txt","w");
+if(!f){
+ Serial.println("file open failed");
+}
+
+
exists
+
SPIFFS.exists(path)
+
+
Returns true if a file with given path exists, false otherwise.
+
+
openDir
+
SPIFFS.openDir(path)
+
+
Opens a directory given its absolute path. Returns a Dir object.
+
+
remove
+
SPIFFS.remove(path)
+
+
Deletes the file given its absolute path. Returns true if file was deleted successfully.
+
+
rename
+
SPIFFS.rename(pathFrom,pathTo)
+
+
Renames file from pathFrom to pathTo. Paths must be absolute. Returns true
+if file was renamed successfully.
+
+
info
+
FSInfofs_info;
+SPIFFS.info(fs_info);
+
+
Fills FSInfo structure with information about
+the file system. Returns true is successful, false otherwise.
This is the structure which may be filled using FS::info method.
+- totalBytes — total size of useful data on the file system
+- usedBytes — number of bytes used by files
+- blockSize — SPIFFS block size
+- pageSize — SPIFFS logical page size
+- maxOpenFiles — max number of files which may be open simultaneously
+- maxPathLength — max file name length (including one byte for zero termination)
+
+
Directory object (Dir)
+
+
The purpose of Dir object is to iterate over files inside a directory.
+It provides three methods: next(), fileName(), and openFile(mode).
+
+
The following example shows how it should be used:
dir.next() returns true while there are files in the directory to iterate over.
+It must be called before calling fileName and openFile functions.
+
+
openFile method takes mode argument which has the same meaning as for SPIFFS.open function.
+
+
File object
+
+
SPIFFS.open and dir.openFile functions return a File object. This object
+supports all the functions of Stream, so you can use readBytes, findUntil,
+parseInt, println, and all other Stream methods.
+
+
There are also some functions which are specific to File object.
+
+
seek
+
file.seek(offset,mode)
+
+
This function behaves like fseek C function. Depending on the value of mode,
+it moves current position in a file as follows:
+
+
+
if mode is SeekSet, position is set to offset bytes from the beginning.
+
if mode is SeekCur, current position is moved by offset bytes.
+
if mode is SeekEnd, position is set to offset bytes from the end of the
+file.
+
+
+
Returns true if position was set successfully.
+
+
position
+
file.position()
+
+
Returns the current position inside the file, in bytes.
+
+
size
+
file.size()
+
+
Returns file size, in bytes.
+
+
name
+
Stringname=file.name();
+
+
Returns file name, as const char*. Convert it to String for storage.
+
+
close
+
file.close()
+
+
Close the file. No other operations should be performed on File object after close function was called.
Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
+
Open Boards Manager from Tools > Board menu and find esp8266 platform.
+
Select the version you need from a drop-down box.
+
Click install button.
+
Don't forget to select your ESP8266 board from Tools > Board menu after installation.
+
+
+
You may optionally use staging boards manager package link:
+http://arduino.esp8266.com/staging/package_esp8266com_index.json. This may contain some new features, but at the same time, some things might be broken.
+
+
Using git version
+
+
This is the suggested installation method for contributors and library developers.
+
+
Prerequisites
+
+
+
Arduino 1.6.8 (or newer, if you know what you are doing)
+
git
+
python 2.7
+
terminal, console, or command prompt (depending on you OS)
+
Internet connection
+
+
+
Instructions
+
+
+
Open the console and go to Arduino directory. This can be either your sketchbook directory (usually <Documents>/Arduino), or the directory of Arduino application itself, the choice is up to you.
+
Clone this repository into hardware/esp8266com/esp8266 directory. Alternatively, clone it elsewhere and create a symlink, if your OS supports them.
This is mostly similar to WiFi shield library. Differences include:
+
+
+
WiFi.mode(m): set mode to WIFI_AP, WIFI_STA, WIFI_AP_STA or WIFI_OFF.
+
call WiFi.softAP(ssid) to set up an open network
+
call WiFi.softAP(ssid, password) to set up a WPA2-PSK network (password should be at least 8 characters)
+
WiFi.macAddress(mac) is for STA, WiFi.softAPmacAddress(mac) is for AP.
+
WiFi.localIP() is for STA, WiFi.softAPIP() is for AP.
+
WiFi.printDiag(Serial) will print out some diagnostic info
+
WiFiUDP class supports sending and receiving multicast packets on STA interface.
+When sending a multicast packet, replace udp.beginPacket(addr, port) with
+udp.beginPacketMulticast(addr, port, WiFi.localIP()).
+When listening to multicast packets, replace udp.begin(port) with
+udp.beginMulticast(WiFi.localIP(), multicast_ip_addr, port).
+You can use udp.destinationIP() to tell whether the packet received was
+sent to the multicast or unicast address.
+
+
+
WiFiServer, WiFiClient, and WiFiUDP behave mostly the same way as with WiFi shield library.
+Four samples are provided for this library.
+You can see more commands here: http://www.arduino.cc/en/Reference/WiFi
+
+
Ticker
+
+
Library for calling functions repeatedly with a certain period. Two examples included.
+
+
It is currently not recommended to do blocking IO operations (network, serial, file) from Ticker
+callback functions. Instead, set a flag inside the ticker callback and check for that flag inside the loop function.
+
+
Here is library to simplificate Ticker usage and avoid WDT reset: TickerScheduler
+
+
EEPROM
+
+
This is a bit different from standard EEPROM class. You need to call EEPROM.begin(size)
+before you start reading or writing, size being the number of bytes you want to use.
+Size can be anywhere between 4 and 4096 bytes.
+
+
EEPROM.write does not write to flash immediately, instead you must call EEPROM.commit()
+whenever you wish to save changes to flash. EEPROM.end() will also commit, and will
+release the RAM copy of EEPROM contents.
+
+
EEPROM library uses one sector of flash located just after the SPIFFS.
+
+
Three examples included.
+
+
I2C (Wire library)
+
+
Wire library currently supports master mode up to approximately 450KHz.
+Before using I2C, pins for SDA and SCL need to be set by calling
+Wire.begin(int sda, int scl), i.e. Wire.begin(0, 2) on ESP-01,
+else they default to pins 4(SDA) and 5(SCL).
+
+
SPI
+
+
SPI library supports the entire Arduino SPI API including transactions, including setting phase (CPHA).
+Setting the Clock polarity (CPOL) is not supported, yet (SPI_MODE2 and SPI_MODE3 not working).
+
+
SoftwareSerial
+
+
An ESP8266 port of SoftwareSerial library done by Peter Lerup (@plerup) supports baud rate up to 115200 and multiples SoftwareSerial instances. See https://github.com/plerup/espsoftwareserial if you want to suggest an improvement or open an issue related to SoftwareSerial.
+
+
ESP-specific APIs
+
+
APIs related to deep sleep and watchdog timer are available in the ESP object, only available in Alpha version.
+
+
ESP.deepSleep(microseconds, mode) will put the chip into deep sleep. mode is one of WAKE_RF_DEFAULT, WAKE_RFCAL, WAKE_NO_RFCAL, WAKE_RF_DISABLED. (GPIO16 needs to be tied to RST to wake from deepSleep.)
+
+
ESP.restart() restarts the CPU.
+
+
ESP.getResetReason() returns String containing the last reset resaon in human readable format.
+
+
ESP.getFreeHeap() returns the free heap size.
+
+
ESP.getChipId() returns the ESP8266 chip ID as a 32-bit integer.
+
+
Several APIs may be used to get flash chip info:
+
+
ESP.getFlashChipId() returns the flash chip ID as a 32-bit integer.
+
+
ESP.getFlashChipSize() returns the flash chip size, in bytes, as seen by the SDK (may be less than actual size).
+
+
ESP.getFlashChipSpeed(void) returns the flash chip frequency, in Hz.
+
+
ESP.getCycleCount() returns the cpu instruction cycle count since start as an unsigned 32-bit. This is useful for accurate timing of very short actions like bit banging.
+
+
ESP.getVcc() may be used to measure supply voltage. ESP needs to reconfigure the ADC
+at startup in order for this feature to be available. Add the following line to the top
+of your sketch to use getVcc:
+
ADC_MODE(ADC_VCC);
+
+
TOUT pin has to be disconnected in this mode.
+
+
Note that by default ADC is configured to read from TOUT pin using analogRead(A0), and
+ESP.getVCC() is not available.
+
+
mDNS and DNS-SD responder (ESP8266mDNS library)
+
+
Allows the sketch to respond to multicast DNS queries for domain names like "foo.local", and DNS-SD (service dicovery) queries.
+See attached example for details.
+
+
SSDP responder (ESP8266SSDP)
+
+
SSDP is another service discovery protocol, supported on Windows out of the box. See attached example for reference.
+
+
DNS server (DNSServer library)
+
+
Implements a simple DNS server that can be used in both STA and AP modes. The DNS server currently supports only one domain (for all other domains it will reply with NXDOMAIN or custom status code). With it clients can open a web server running on ESP8266 using a domain name, not an IP address.
+See attached example for details.
+
+
Servo
+
+
This library exposes the ability to control RC (hobby) servo motors. It will support upto 24 servos on any available output pin. By defualt the first 12 servos will use Timer0 and currently this will not interfere with any other support. Servo counts above 12 will use Timer1 and features that use it will be effected.
+While many RC servo motors will accept the 3.3V IO data pin from a ESP8266, most will not be able to run off 3.3v and will require another power source that matches their specifications. Make sure to connect the grounds between the ESP8266 and the servo motor power supply.
+
+
Other libraries (not included with the IDE)
+
+
Libraries that don't rely on low-level access to AVR registers should work well. Here are a few libraries that were verified to work:
DHT-sensor-library - Arduino library for the DHT11/DHT22 temperature and humidity sensors. Download latest v1.1.1 library and no changes are necessary. Older versions should initialize DHT as follows: DHT dht(DHTPIN, DHTTYPE, 15)
+
DimSwitch - Control electronic dimmable ballasts for fluorescent light tubes remotely as if using a wall switch.
+
Encoder - Arduino library for rotary encoders. Version 1.4 supports ESP8266.
+
esp8266_mdns - mDNS queries and responses on esp8266. Or to describe it another way: An mDNS Client or Bonjour Client library for the esp8266.
+
Homie for ESP8266 - Arduino framework for ESP8266 implementing Homie, an MQTT convention for the IoT.
+
NeoPixel - Adafruit's NeoPixel library, now with support for the ESP8266 (use version 1.0.2 or higher from Arduino's library manager).
+
NeoPixelBus - Arduino NeoPixel library compatible with ESP8266. Use the "DmaDriven" or "UartDriven" branches for ESP8266. Includes HSL color support and more.
RTC - Arduino Library for Ds1307 & Ds3231 compatible with ESP8266.
+
Souliss, Smart Home - Framework for Smart Home based on Arduino, Android and openHAB.
+
ST7735 - Adafruit's ST7735 library modified to be compatible with ESP8266. Just make sure to modify the pins in the examples as they are still AVR specific.
+
Task - Arduino Nonpreemptive multitasking library. While similiar to the included Ticker library in the functionality provided, this library was meant for cross Arduino compatibility.
+
TickerScheduler - Library provides simple scheduler for Ticker to avoid WDT reset
+
Teleinfo - Generic French Power Meter library to read Teleinfo energy monitoring data such as consuption, contract, power, period, ... This library is cross platform, ESP8266, Arduino, Particle, and simple C++. French dedicated post on author's blog and all related information about Teleinfo also available.
+
UTFT-ESP8266 - UTFT display library with support for ESP8266. Only serial interface (SPI) displays are supported for now (no 8-bit parallel mode, etc). Also includes support for the hardware SPI controller of the ESP8266.
+
WiFiManager - WiFi Connection manager with web captive portal. If it can't connect, it starts AP mode and a configuration portal so you can choose and enter WiFi credentials.
SdFat-beta - SD-card library with support for long filenames, software- and hardware-based SPI and lots more.
+
FastLED - a library for easily & efficiently controlling a wide variety of LED chipsets, like the Neopixel (WS2812B), DotStar, LPD8806 and many more. Includes fading, gradient, color conversion functions.
+
+
+
+
+
diff --git a/versions/2.2.0-rc1/doc/ota_updates/a-ota-external-serial-terminal-output.png b/versions/2.2.0-rc1/doc/ota_updates/a-ota-external-serial-terminal-output.png
new file mode 100644
index 000000000..cc36c7d05
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/a-ota-external-serial-terminal-output.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/a-ota-network-terminal.png b/versions/2.2.0-rc1/doc/ota_updates/a-ota-network-terminal.png
new file mode 100644
index 000000000..9b9bd47f4
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/a-ota-network-terminal.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/a-ota-ota-port-selection.png b/versions/2.2.0-rc1/doc/ota_updates/a-ota-ota-port-selection.png
new file mode 100644
index 000000000..057bdb706
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/a-ota-ota-port-selection.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/a-ota-ota-upload-complete.png b/versions/2.2.0-rc1/doc/ota_updates/a-ota-ota-upload-complete.png
new file mode 100644
index 000000000..85f8ba56e
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/a-ota-ota-upload-complete.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/a-ota-ota-upload-configuration.png b/versions/2.2.0-rc1/doc/ota_updates/a-ota-ota-upload-configuration.png
new file mode 100644
index 000000000..1d31a784c
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/a-ota-ota-upload-configuration.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/a-ota-python-configuration.png b/versions/2.2.0-rc1/doc/ota_updates/a-ota-python-configuration.png
new file mode 100644
index 000000000..0e78f72a1
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/a-ota-python-configuration.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/a-ota-serial-upload-configuration.png b/versions/2.2.0-rc1/doc/ota_updates/a-ota-serial-upload-configuration.png
new file mode 100644
index 000000000..89f969d43
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/a-ota-serial-upload-configuration.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/a-ota-sketch-selection.png b/versions/2.2.0-rc1/doc/ota_updates/a-ota-sketch-selection.png
new file mode 100644
index 000000000..50ef7ca51
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/a-ota-sketch-selection.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/a-ota-ssid-pass-entry.png b/versions/2.2.0-rc1/doc/ota_updates/a-ota-ssid-pass-entry.png
new file mode 100644
index 000000000..3b678416c
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/a-ota-ssid-pass-entry.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/a-ota-upload-complete-and-joined-wifi.png b/versions/2.2.0-rc1/doc/ota_updates/a-ota-upload-complete-and-joined-wifi.png
new file mode 100644
index 000000000..479335d90
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/a-ota-upload-complete-and-joined-wifi.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/a-ota-upload-password-authenticating-ok.png b/versions/2.2.0-rc1/doc/ota_updates/a-ota-upload-password-authenticating-ok.png
new file mode 100644
index 000000000..052d0da8b
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/a-ota-upload-password-authenticating-ok.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/a-ota-upload-password-passing-again-upload-ok.png b/versions/2.2.0-rc1/doc/ota_updates/a-ota-upload-password-passing-again-upload-ok.png
new file mode 100644
index 000000000..cc6ea94dc
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/a-ota-upload-password-passing-again-upload-ok.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/a-ota-upload-password-passing-upload-ok.png b/versions/2.2.0-rc1/doc/ota_updates/a-ota-upload-password-passing-upload-ok.png
new file mode 100644
index 000000000..e9254ebec
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/a-ota-upload-password-passing-upload-ok.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/a-ota-upload-password-prompt.png b/versions/2.2.0-rc1/doc/ota_updates/a-ota-upload-password-prompt.png
new file mode 100644
index 000000000..e3ecb520d
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/a-ota-upload-password-prompt.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/ota-web-browser-form-ok.png b/versions/2.2.0-rc1/doc/ota_updates/ota-web-browser-form-ok.png
new file mode 100644
index 000000000..ed44e9cbb
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/ota-web-browser-form-ok.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/ota-web-browser-form.png b/versions/2.2.0-rc1/doc/ota_updates/ota-web-browser-form.png
new file mode 100644
index 000000000..87872393f
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/ota-web-browser-form.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/ota-web-path-to-binary.png b/versions/2.2.0-rc1/doc/ota_updates/ota-web-path-to-binary.png
new file mode 100644
index 000000000..9237d8780
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/ota-web-path-to-binary.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/ota-web-serial-monitor-ready.png b/versions/2.2.0-rc1/doc/ota_updates/ota-web-serial-monitor-ready.png
new file mode 100644
index 000000000..5ce011170
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/ota-web-serial-monitor-ready.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/ota-web-serial-monitor-reboot.png b/versions/2.2.0-rc1/doc/ota_updates/ota-web-serial-monitor-reboot.png
new file mode 100644
index 000000000..0fd469e11
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/ota-web-serial-monitor-reboot.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/ota-web-show-verbose-compilation.png b/versions/2.2.0-rc1/doc/ota_updates/ota-web-show-verbose-compilation.png
new file mode 100644
index 000000000..00ac3871f
Binary files /dev/null and b/versions/2.2.0-rc1/doc/ota_updates/ota-web-show-verbose-compilation.png differ
diff --git a/versions/2.2.0-rc1/doc/ota_updates/readme.html b/versions/2.2.0-rc1/doc/ota_updates/readme.html
new file mode 100644
index 000000000..994f05f02
--- /dev/null
+++ b/versions/2.2.0-rc1/doc/ota_updates/readme.html
@@ -0,0 +1,757 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OTA Update · ESP8266 Arduino Core
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This documentation is for version 2.2.0-rc1. Other versions.
+
OTA (Over the Air) update is the process of loading the firmware to ESP module using Wi-Fi connection rather that a serial port. Such functionality became extremely useful in case of limited or no physical access to the module.
Arduino IDE option is intended primarily for software development phase. The two other options would be more useful after deployment, to provide module with application updates manually with a web browser or automatically using a http server.
+
+
In any case first firmware upload have to be done over a serial port. If OTA routines are correctly implemented in a sketch, then all subsequent uploads may be done over the air.
+
+
There is no imposed security on OTA process from being hacked. It is up to developer to ensure that updates are allowed only from legitimate / trusted source. Once update is complete, module restarts and new code is executed. Developer should ensure that application running on module is shut down and restarted in a safe manner. Chapters below provide additional information regarding security and safety of OTA process.
+
+
Security
+
+
Module has to be exposed wirelessly to get it updated with a new sketch. That poses chances of module being violently hacked and loaded with some other code. To reduce likelihood of being hacked consider protecting your uploads with a password, selecting certain OTA port, etc.
+
+
Check functionality provided with ArduinoOTA library that may improve security:
Certain protection functionality is already built in and do not require any additional coding by developer. ArduinoOTA and espota.py use Digest-MD5 to authenticate upload. Integrity of transferred data is verified on ESP side using MD5 checksum.
+
+
Make your own risk analysis and depending on application decide what library functions to implement. If required consider implementation of other means of protection from being hacked, e.g. exposing module for uploads only according to specific schedule, trigger OTA only be user pressing dedicated “Update” button, etc.
+
+
Safety
+
+
OTA process takes ESP’s resources and bandwidth during upload. Then module is restarted and a new sketch executed. Analyse and test how it affects functionality of your existing and new sketch.
+
+
If ESP is placed in remote location and controlling some equipment, you should put additional attention what happens if operation of this equipment is suddenly interrupted by update process. Therefore decide how to put this equipment into safe state before starting the update. For instance your module may be controlling a garden watering system in a sequence. If this sequence is not properly shut down and a water valve left open, your garden may be flooded if this valve is not closed after OTA is finished and module restarts.
+
+
The following functions are provided with ArduinoOTA library and intended to handle functionality of your application during specific stages of OTA or on an OTA error:
Flash chip size needs a size that is able to hold the old sketch (currently running) and the new sketch (OTA) at the same time.
+Keep in mind that the File system and EEPROM for example needs space too (one time) see flash layout.
+cpp
+ESP.getFreeSketchSpace();
+
+can be used for checking the free space for the new sketch.
+
+
For overview of memory layout, where new sketch is stored and how it is copied during OTA process see Update process - memory view.
+
+
The following chapters provide more details and specific methods of doing OTA.
+
+
Arduino IDE
+
+
Uploading modules wirelessly from Arduino IDE is intended for the following typical scenarios:
+- during firmware development as a quicker alternative to loading over a serial
+- for updating small quantity of modules
+- only if modules are available on the same network as the computer with Arduino IDE
+
+
Requirements
+
+
+
The ESP and the computer must be connected to the same network.
+
+
+
Application Example
+
+
Instructions below show configuration of OTA on NodeMCU 1.0 (ESP-12E Module) board. You can use any other board assuming that it meets requirements described above. This instruction is valid for all operating systems supported by Arduino IDE. Screen captures have been made on Windows 7 and you may see small differences (like name of serial port) if you are using Linux and MacOS.
+
+
+
Before you begin, please make sure that you have the following s/w installed:
Note: Windows users should select “Add python.exe to Path” (see below – this option is not selected by default).
+
+
+
+
Now prepare the sketch and configuration for the upload over a serial port.
+
+
+
Start Arduino IDE and load sketch BasicOTA.ino available under File > Examples > ArduinoOTA
+
+
+
+
- Update SSID and password in the sketch so the module can join your Wi-Fi network
+ 
+
+- Configure upload parameters as below (you may need to adjust configuration if you are using a different module):
+ 
+
+ **Note:** Depending on version of platform package and board you have, you may see ``` Upload Using: ``` in the menu above. This option is inactive and it does not matter what you select. It has been left for compatibility with older implementation of OTA and is targeted for removal in platform package version 2.2.0.
+
+
+
Upload the sketch (Ctrl+U). Once done, open Serial Monitor (Ctrl+Shift+M) and check if module has joined your Wi-Fi network:
+
+
+
Only if module is connected to network, after a couple of seconds, the esp8266-ota port will show up in Arduino IDE. Select port with IP adress shown in Serial Monitor in previus step:
+
+
+
+
Note: If OTA port does not show up, exit Arduino IDE, open it again and check if port is there. If it does not help check your firewall settings.
+
Now get ready for your first OTA upload by selecting the OTA port:
+
+
+
+
Note: The menu entry Upload Speed: does not matter at this point as it concerns the serial port. Just left it unchanged.
+
If you have successfully completed all the above steps, you can upload (Ctrl+U) the same (or any other) sketch over OTA:
+
+
+
+
+
Note: To be able to upload your sketch over and over again using OTA, you need to embed OTA routines inside. Please use BasicOTA.ino as an example.
+
+
Password Protection
+
+
Protecting your OTA uploads with password is really straightforward. All you need to do, is to include the following statement in your code:
+
ArduinoOTA.setPassword((constchar*)"123");
+
+
Where 123 is a sample password that you should replace with your own.
+
+
Before implementing it in your sketch, it is a good idea to check how it works using BasicOTA.ino sketch available under File > Examples > ArduinoOTA. Go ahead, open BasicOTA.ino, uncomment the above statement that is already there, and upload the sketch. To make troubleshooting easier, do not modify example sketch besides what is absolutely required. This is including original simple 123 OTA password. Then attempt to upload sketch again (using OTA). After compilation is complete, once upload is about to begin, you should see prompt for password as follows:
+
+
+
+
Enter the password and upload should be initiated as usual with the only difference being Authenticating...OK message visible in upload log.
+
+
+
+
You will not be prompted for a reentering the same password next time. Arduino IDE will remember it for you. You will see prompt for password only after reopening IDE, or if you change it in your sketch, upload the sketch and then try to upload it again.
+
+
Please note, it is possible to reveal password entered previously in Arduino IDE, if IDE has not been closed since last upload. This can be done by enabling Show verbose output during: upload in File > Preferences and attempting to upload the module.
+
+
+
+
The picture above shows that the password is visible in log as it is passed to espota.py upload script.
+
+
Another example below shows situation when password is changed between uploads.
+
+
+
+
When uploading, Arduino IDE used previously entered password, so the upload failed and that has been clearly reported by IDE. Only then IDE prompted for a new password. That was entered correctly and second attempt to upload has been successful.
+
+
Troubleshooting
+
+
If OTA update fails, first step is to check for error messages that may be shown in upload window of Arduino IDE. If this is not providing any useful hints try to upload again while checking what is shown by ESP on serial port. Serial Monitor from IDE will not be useful in that case. When attempting to open it, you will likely see the following:
+
+
+
+
This window is for Arduino Yún and not yet implemented for esp8266/Arduino. It shows up because IDE is attempting to open Serial Monitor using network port you have selected for OTA upload.
+
+
Instead you need an external serial monitor. If you are a Windows user check out Termite. This is handy, slick and simple RS232 terminal that does not impose RTS or DTR flow control. Such flow control may cause issues if you are using respective lines to toggle GPIO0 and RESET pins on ESP for upload.
+
+
Select COM port and baud rate on external terminal program as if you were using Arduino Serial Monitor. Please see typical settings for Termite below:
+
+
+
+
Then run OTA from IDE and look what is displayed on terminal. Successful ArduinoOTA process using BasicOTA.ino sketch looks like below (IP address depends on your network configuration):
+
+
+
+
If upload fails you will likely see errors caught by the uploader, exception and the stack dump, or both.
+
+
The most common causes of OTA failure are as follows:
+* not enough physical memory on the chip (e.g. ESP01 with 512K flash memory is not enough for OTA),
+* too much memory declared for SPIFFS so new sketch will not fit between existing sketch and SPIFFS – see Update process - memory view,
+* too little memory declared in Arduino IDE for your selected board (i.e. less than physical size).
+
+
For more details regarding flash memory layout please check File system.
+For overview where new sketch is stored, how it is copied and how memory is organized for the purpose of OTA see Update process - memory view.
+
+
Web Browser
+
+
Updates described in this chapter are done with a web browser that can be useful in the following typical scenarios:
+
+
+
after application deployment if loading directly from Arduino IDE is inconvenient or not possible
+
after deployment if user is unable to expose module for OTA from external update server
+
to provide updates after deployment to small quantity of modules when setting an update server is not practicable
+
+
+
Requirements
+
+
+
The ESP and the computer must be connected to the same network.
+
+
+
Implementation Overview
+
+
Updates with a web browser are implemented using ESP8266HTTPUpdateServer class together with ESP8266WebServer and ESP8266mDNS classes. The following code is required to get it work:
Mac OSX and iOS - support is already built in / no any extra s/w is required
+
+
+
Prepare the sketch and configuration for initial upload with a serial port.
+
+
+
Start Arduino IDE and load sketch WebUpdater.ino available under File > Examples > ESP8266HTTPUpdateServer.
+
Update SSID and password in the sketch so the module can join your Wi-Fi network.
+
Open File > Preferences, look for “Show verbose output during:” and check out “compilation” option.
+
+
+
+
Note: This setting will be required in step 5 below. You can uncheck this setting afterwards.
+
+
Upload sketch (Ctrl+U). Once done open Serial Monitor (Ctrl+Shift+M) and check if you see the following message displayed, that contains url for OTA update.
+
+
+
+
Note: Such message will be shown only after module successfully joins network and is ready for an OTA upload.
+
Now open web browser and enter the url provided on Serial Monitor, i.e. http://esp8266-webupdate.local/update. Once entered, browser should display a form like below that has been served by your module. The form invites you to choose a file for update.
+
+
+
+
Note: If entering http://esp8266-webupdate.local/update does not work, try replacing esp8266-webupdate with module’s IP address. For example, if your module IP is 192.168.1.100 then url should be http://192.168.1.100/update. This workaround is useful in case the host software installed in step 2 does not work. If still nothing works and there are no clues on Serial Monitor, try to diagnose issue by opening provided url in Google Chrome, pressing F12 and checking contents of “Console” and “Network” tabs. Chrome provides some advanced logging on these tabs.
+
To obtain the file navigate to directory used by Arduino IDE to store results of compilation. You can check the path to this file in compilation log shown in IDE debug window as marked below.
+
+
+
Now press “Choose File” in web browser, go to directory identified in step 5 above, find the file “WebUpdater.cpp.bin” and upload it. If upload is successful you will see “OK” on web browser like below.
+
+
+
+
Module will reboot that should be visible on Serial Monitor:
+
+
+
+
Just after reboot you should see exactly the same message HTTPUpdateServer ready! Open http:// esp8266-webupdate.local /update in your browser like in step 3. This is because module has been loaded again with the same code – first using serial port, and then using OTA.
+
+
+
Once you are comfortable with this procedure go ahead and modify WebUpdater.ino sketch to print some additional messages, compile it, locate new binary file and upload it using web browser to see entered changes on a Serial Monitor.
+
+
You can also add OTA routines to your own sketch following guidelines in Implementation Overview above. If this is done correctly you should be always able to upload new sketch over the previous one using a web browser.
+
+
In case OTA update fails dead after entering modifications in your sketch, you can always recover module by loading it over a serial port. Then diagnose the issue with sketch using Serial Monitor. Once the issue is fixed try OTA again.
+
+
HTTP Server
+
+
ESPhttpUpdate class can check for updates and download a binary file from HTTP web server.
+It is possible to download updates from every IP or domain address on the network or Internet.
+
+
Requirements
+
+
+
web server
+
+
+
Arduino code
+
+
Simple updater
+
+
Simple updater downloads the file every time the function is called.
Its possible to point update function to a script at the server.
+If version string argument is given, it will be sent to the server.
+Server side script can use this to check if update should be performed.
+
+
Server side script can respond as follows:
+- response code 200, and send the firmware image,
+- or response code 304 to notify ESP that no update is required.
+
t_httpUpdate_returnret=ESPhttpUpdate.update("192.168.0.2",80,"/esp/update/arduino.php","optional current version string here");
+switch(ret){
+ caseHTTP_UPDATE_FAILED:
+ Serial.println("[update] Update failed.");
+ break;
+ caseHTTP_UPDATE_NO_UPDATES:
+ Serial.println("[update] Update no Update.");
+ break;
+ caseHTTP_UPDATE_OK:
+ Serial.println("[update] Update ok.");// may not called we reboot the ESP
+ break;
+}
+
+
Server request handling
+
+
Simple updater
+
+
For the simple updater the server only needs to deliver the binary file for update.
+
+
Advanced updater
+
+
For advanced update management a script needs to run at the server side, for example a PHP script.
+At every update request the ESP sends some information in HTTP headers to the server.
With this information the script now can check if an update is needed. It is also possible to deliver different binaries based on the MAC address for example.
The Stream Interface is the base for all other update modes like OTA, http Server / client.
+
+
Updater class
+
+
Updater is in the Core and deals with writing the firmware to the flash,
+checking its integrity and telling the bootloader to load the new firmware on the next boot.
+
+
Update process - memory view
+
+
+
The new sketch will be stored in the space between the old sketch and the spiff.
+
on the next reboot the "eboot" bootloader check for commands.
Pin numbers in Arduino correspond directly to the ESP8266 GPIO pin numbers. pinMode, digitalRead, and digitalWrite functions work as usual, so to read GPIO2, call digitalRead(2).
+
+
Digital pins 0—15 can be INPUT, OUTPUT, or INPUT_PULLUP.
+Pin 16 can be INPUT, OUTPUT or INPUT_PULLDOWN_16. At startup, pins are configured as INPUT.
+
+
Pins may also serve other functions, like Serial, I2C, SPI. These functions are normally activated by the corresponding library. The diagram below shows pin mapping for the popular ESP-12 module.
+
+
+
+
Digital pins 6—11 are not shown on this diagram because they are used to connect flash memory chip on most modules. Trying to use these pins as IOs will likely cause the program to crash.
+
+
Note that some boards and modules (ESP-12ED, NodeMCU 1.0) also break out pins 9 and 11. These may be used as IO if flash chip works in DIO mode (as opposed to QIO, which is the default one).
+
+
Pin interrupts are supported through attachInterrupt, detachInterrupt functions.
+Interrupts may be attached to any GPIO pin, except GPIO16. Standard Arduino interrupt
+types are supported: CHANGE, RISING, FALLING.
+
+
Analog input
+
+
ESP8266 has a single ADC channel available to users. It may be used either to read voltage at ADC pin, or to read module supply voltage (VCC).
+
+
To read external voltage applied to ADC pin, use analogRead(A0). Input voltage range is 0 — 1.0V.
+
+
To read VCC voltage, use ESP.getVcc() and ADC pin must be kept unconnected. Additionally, the following line has to be added to the sketch:
+
ADC_MODE(ADC_VCC);
+
+
This line has to appear outside of any functions, for instance right after the #include lines of your sketch.
+
+
Analog output
+
+
analogWrite(pin, value) enables software PWM on the given pin. PWM may be used on pins 0 to 16.
+Call analogWrite(pin, 0) to disable PWM on the pin. value may be in range from 0 to PWMRANGE, which is equal to 1023 by default. PWM range may be changed by calling analogWriteRange(new_range).
+
+
PWM frequency is 1kHz by default. Call analogWriteFreq(new_frequency) to change the frequency.
+
+
Timing and delays
+
+
millis() and micros() return the number of milliseconds and microseconds elapsed after reset, respectively.
+
+
delay(ms) pauses the sketch for a given number of milliseconds and allows WiFi and TCP/IP tasks to run.
+delayMicroseconds(us) pauses for a given number of microseconds.
+
+
Remember that there is a lot of code that needs to run on the chip besides the sketch
+when WiFi is connected. WiFi and TCP/IP libraries get a chance to handle any pending
+events each time the loop() function completes, OR when delay is called.
+If you have a loop somewhere in your sketch that takes a lot of time (>50ms) without
+calling delay, you might consider adding a call to delay function to keep the WiFi
+stack running smoothly.
+
+
There is also a yield() function which is equivalent to delay(0). The delayMicroseconds
+function, on the other hand, does not yield to other tasks, so using it for delays
+more than 20 milliseconds is not recommended.
+
+
Serial
+
+
Serial object works much the same way as on a regular Arduino. Apart from hardware FIFO (128 bytes for TX and RX) HardwareSerial has additional 256-byte TX and RX buffers. Both transmit and receive is interrupt-driven. Write and read functions only block the sketch execution when the respective FIFO/buffers are full/empty.
+
+
Serial uses UART0, which is mapped to pins GPIO1 (TX) and GPIO3 (RX). Serial may be remapped to GPIO15 (TX) and GPIO13 (RX) by calling Serial.swap() after Serial.begin. Calling swap again maps UART0 back to GPIO1 and GPIO3.
+
+
Serial1 uses UART1, TX pin is GPIO2. UART1 can not be used to receive data because normally it's RX pin is occupied for flash chip connection. To use Serial1, call Serial1.begin(baudrate).
+
+
If Serial1 is not used and Serial is not swapped - TX for UART0 can be mapped to GPIO2 instead by calling Serial.set_tx(2) after Serial.begin or directly with Serial.begin(baud, config, mode, 2).
+
+
By default the diagnostic output from WiFi libraries is disabled when you call Serial.begin. To enable debug output again, call Serial.setDebugOutput(true). To redirect debug output to Serial1 instead, call Serial1.setDebugOutput(true).
+
+
You also need to use Serial.setDebugOutput(true) to enable output from printf() function.
+
+
Both Serial and Serial1 objects support 5, 6, 7, 8 data bits, odd (O), even (E), and no (N) parity, and 1 or 2 stop bits. To set the desired mode, call Serial.begin(baudrate, SERIAL_8N1), Serial.begin(baudrate, SERIAL_6E2), etc.
+
+
Progmem
+
+
The Program memory features work much the same way as on a regular Arduino; placing read only data and strings in read only memory and freeing heap for your application.
+The important difference is that on the ESP8266 the literal strings are not pooled. This means that the same literal string defined inside a F("") and/or PSTR("") will take up space for each instance in the code. So you will need to manage the duplicate strings yourself.
+
+
There is one additional helper macro to make it easier to pass const PROGMEM strings to methods that take a __FlashStringHelper called FPSTR(). The use of this will help make it easier to pool strings.
+Not pooling strings...
" + header.innerHTML + "";
+ else if (this_level <= level){ // higher level than before; end parent ol
+ for(i = this_level; i < level; i++) {
+ html += "
"+settings.listType+">"
+ }
+ html += "
" + header.innerHTML + "";
+ }
+ else if (this_level > level) { // lower level than before; expand the previous to contain a ol
+ for(i = this_level; i > level; i--) {
+ html += "<"+settings.listType+">
"
+ }
+ html += "" + header.innerHTML + "";
+ }
+ level = this_level; // update for the next one
+ });
+ html += ""+settings.listType+">";
+ if (!settings.noBackToTopLinks) {
+ $(document).on('click', '.back-to-top', function() {
+ $(window).scrollTop(0);
+ window.location.hash = '';
+ });
+ }
+
+ render[settings.showEffect]();
+ };
+})(jQuery);
diff --git a/versions/2.2.0-rc1/ver_index.html b/versions/2.2.0-rc1/ver_index.html
new file mode 100644
index 000000000..e69de29bb
diff --git a/versions/2.2.0/badge.svg b/versions/2.2.0/badge.svg
new file mode 100644
index 000000000..e5fccb62d
--- /dev/null
+++ b/versions/2.2.0/badge.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/versions/2.2.0/doc/ESP01_connect.jpg b/versions/2.2.0/doc/ESP01_connect.jpg
new file mode 100644
index 000000000..6b0c24088
Binary files /dev/null and b/versions/2.2.0/doc/ESP01_connect.jpg differ
diff --git a/versions/2.2.0/doc/ESP_improved_stability.png b/versions/2.2.0/doc/ESP_improved_stability.png
new file mode 100644
index 000000000..35dca4bcf
Binary files /dev/null and b/versions/2.2.0/doc/ESP_improved_stability.png differ
diff --git a/versions/2.2.0/doc/ESP_min.png b/versions/2.2.0/doc/ESP_min.png
new file mode 100644
index 000000000..25350ed66
Binary files /dev/null and b/versions/2.2.0/doc/ESP_min.png differ
diff --git a/versions/2.2.0/doc/ESP_to_serial.png b/versions/2.2.0/doc/ESP_to_serial.png
new file mode 100644
index 000000000..54723939b
Binary files /dev/null and b/versions/2.2.0/doc/ESP_to_serial.png differ
diff --git a/versions/2.2.0/doc/Troubleshooting/ESP_Exception_Decoderp.png b/versions/2.2.0/doc/Troubleshooting/ESP_Exception_Decoderp.png
new file mode 100644
index 000000000..0223d0573
Binary files /dev/null and b/versions/2.2.0/doc/Troubleshooting/ESP_Exception_Decoderp.png differ
diff --git a/versions/2.2.0/doc/Troubleshooting/debug_level.png b/versions/2.2.0/doc/Troubleshooting/debug_level.png
new file mode 100644
index 000000000..3d3532183
Binary files /dev/null and b/versions/2.2.0/doc/Troubleshooting/debug_level.png differ
diff --git a/versions/2.2.0/doc/Troubleshooting/debug_port.png b/versions/2.2.0/doc/Troubleshooting/debug_port.png
new file mode 100644
index 000000000..3725567e1
Binary files /dev/null and b/versions/2.2.0/doc/Troubleshooting/debug_port.png differ
diff --git a/versions/2.2.0/doc/Troubleshooting/debugging.html b/versions/2.2.0/doc/Troubleshooting/debugging.html
new file mode 100644
index 000000000..585a17d7a
--- /dev/null
+++ b/versions/2.2.0/doc/Troubleshooting/debugging.html
@@ -0,0 +1,388 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Debugging · ESP8266 Arduino Core
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This documentation is for version 2.2.0. Other versions.
+
ESPresso Lite 1.0 (beta version) is an Arduino-compatible Wi-Fi development board powered by Espressif System's own ESP8266 WROOM-02 module. It has breadboard-friendly breakout pins with in-built LED, two reset/flash buttons and a user programmable button . The operating voltage is 3.3VDC, regulated with 800mA maximum current. Special distinctive features include on-board I2C pads that allow direct connection to OLED LCD and sensor boards.
+
+
ESPresso Lite 2.0
+
+
ESPresso Lite 2.0 is an Arduino-compatible Wi-Fi development board based on an earlier V1 (beta version). Re-designed together with Cytron Technologies, the newly-revised ESPresso Lite V2.0 features the auto-load/auto-program function, eliminating the previous need to reset the board manually before flashing a new program. It also feature two user programmable side buttons and a reset button. The special distinctive features of on-board pads for I2C sensor and actuator is retained.
+
+
NodeMCU 0.9
+
+
Pin mapping
+
+
Pin numbers written on the board itself do not correspond to ESP8266 GPIO pin numbers. Constants are defined to make using this board easier:
If you want to use NodeMCU pin 5, use D5 for pin number, and it will be translated to 'real' GPIO pin 14.
+
+
NodeMCU 1.0
+
+
This module is sold under many names for around $6.50 on AliExpress and it's one of the cheapest, fully integrated ESP8266 solutions.
+
+
It's an open hardware design with an ESP-12E core and 4 MB of SPI flash.
+
+
Acording to the manufacturer, "with a micro USB cable, you can connect NodeMCU devkit to your laptop and flash it without any trouble". This is more or less true: the board comes with a CP2102 onboard USB to serial adapter which just works, well, the majority of the time. Sometimes flashing fails and you have to reset the board by holding down FLASH + RST, then releasing FLASH, then releasing RST. This forces the CP2102 device to power cycle and to be re-numbered by Linux.
+
+
The board also features a NCP1117 voltage regulator, a blue LED on GPIO16 and a 220k/100k Ohm voltage divider on the ADC input pin.
This board comes with 2 MB of SPI flash and optional accessories (e.g. evaluation board ESP8266-EVB or BAT-BOX for batteries).
+
+
The basic module has three solder jumpers that allow you to switch the operating mode between SDIO, UART and FLASH.
+
+
The board is shipped for FLASH operation mode, with jumpers TD0JP=0, IO0JP=1, IO2JP=1.
+
+
Since jumper IO0JP is tied to GPIO0, which is PIN 21, you'll have to ground it before programming with a USB to serial adapter and reset the board by power cycling it.
+
+
UART pins for programming and serial I/O are GPIO1 (TXD, pin 3) and GPIO3 (RXD, pin 4).
This is a stripped down version of the above. Behaves identically in terms of jumpers but has less pins readily available for I/O. Still 2 MB of SPI flash.
+
+
Olimex ESP8266-EVB
+
+
It's a Olimex MOD-WIFI-ESP8266-DEV module installed on the headers of a development board which features some breakout connectors, a button (GPIO0) and a relay (GPIO5).
+
+
Programming is pretty straightforward: the board is supported in the Arduino IDE after installing it via the Board Manager. To download a program you just have to connect GND/RX/TX from a serial/USB adapter to the UEXT connector and press the only button before applying power to enter UART mode.
+
+
Don't connect 5V from the serial/USB adapter to the board or you won't be able to power cycle it for UART mode.
This guide is also useful for the first setup, since it contains the UEXT connector pinout.
+
+
Board variants include:
+ * ESP8266-EVB-BAT: comes with built-in LiPo charger and step-up converter
+ * ESP8266-EVB-BAT-BOX: as above, but enclosd in a plastic box (non-weatherproof)
ESPino integrates the ESP-12 module with a 3.3v regulator, CP2104 USB-Serial bridge and a micro USB connector for easy programming. It is designed for fitting in a breadboard and has an RGB Led and two buttons for easy prototyping.
+
+
For more information about the hardware, pinout diagram and programming procedures, please see the datasheet.
WifInfo integrates the ESP-12 or ESP-07+Ext antenna module with a 3.3v regulator and the hardware to be able to measure French telemetry issue from ERDF powering meter serial output. It has a USB connector for powering, an RGB WS2812 Led, 4 pins I2C connector to fit OLED or sensor, and two buttons + FTDI connector and auto reset feature.
+
+
For more information, please see WifInfo related blog entries, github and community forum.
+
+
Generic ESP8266 modules
+
+
These modules come in different form factors and pinouts. See the page at ESP8266 community wiki for more info:
+ESP8266 Module Family.
+
+
Usually these modules have no bootstapping resistors on board, insufficient decoupling capacitors, no voltage regulator, no reset circuit, and no USB-serial adapter. This makes using them somewhat tricky, compared to development boards which add these features.
+
+
In order to use these modules, make sure to observe the following:
+
+
+
Provide sufficient power to the module. For stable use of the ESP8266 a power supply with 3.3V and >= 250mA is required. Using the power available from USB to Serial adapter is not recommended, these adapters typically do not supply enough current to run ESP8266 reliably in every situation. An external supply or regulator along with filtering capacitors is preferred.
+
Connect bootstapping resistors to GPIO0, GPIO2, GPIO15 according to the schematics below.
+
Put ESP8266 into bootloader mode before uploading code.
+
+
+
Serial Adapter
+
+
There are many different USB to Serial adapters / boards.
+To be able to put ESP8266 into bootloader mode using serial handshaking lines, you need the adapter which breaks out RTS and DTR outputs. CTS and DSR are not useful for upload (they are inputs). Make sure the adapter can work with 3.3V IO voltage: it should have a jumper or a switch to select between 5V and 3.3V, or be marked as 3.3V only.
+
+
Adapters based around the following ICs should work:
Reset is also named RSBT or REST (adding PullUp improves the stability of the module)
+
GPIO2 is alternative TX for the boot loader mode
+
Directly connecting a pin to VCC or GND is not a substitute for a PullUp or PullDown resistor, doing this can break upload management and the serial console, instability has also been noted in some cases.
+
+
+
+
ESP to Serial
+
+
+
+
Minimal Hardware Setup for Bootloading only
+
+
ESPxx Hardware
+
+
+
+
PIN
+
Resistor
+
Serial Adapter
+
+
+
+
VCC
+
+
VCC (3.3V)
+
+
+
GND
+
+
GND
+
+
+
TX or GPIO2
+
+
RX
+
+
+
RX
+
+
TX
+
+
+
GPIO0
+
+
GND
+
+
+
Reset
+
+
RTS*
+
+
+
GPIO15
+
PullDown
+
+
+
+
CH_PD
+
PullUp
+
+
+
+
+
+
Note
+
+
+
if no RTS is used a manual power toggle is needed
+
+
+
+
Minimal Hardware Setup for Running only
+
+
ESPxx Hardware
+
+
+
+
PIN
+
Resistor
+
Power supply
+
+
+
+
VCC
+
+
VCC (3.3V)
+
+
+
GND
+
+
GND
+
+
+
GPIO0
+
PullUp
+
+
+
+
GPIO15
+
PullDown
+
+
+
+
CH_PD
+
PullUp
+
+
+
+
+
Minimal
+
+
+
+
Improved Stability
+
+
+
+
Boot Messages and Modes
+
+
The ESP module checks at every boot the Pins 0, 2 and 15.
+based on them its boots in different modes:
+
+
+
+
GPIO15
+
GPIO0
+
GPIO2
+
Mode
+
+
+
+
0V
+
0V
+
3.3V
+
Uart Bootloader
+
+
+
0V
+
3.3V
+
3.3V
+
Boot sketch (SPI flash)
+
+
+
3.3V
+
x
+
x
+
SDIO mode (not used for Arduino)
+
+
+
+
at startup the ESP prints out the current boot mode example:
+
+rst cause:2, boot mode:(3,6)
+
+
+
note:
+ - GPIO2 is used as TX output and the internal Pullup is enabled on boot.
+
+
rst cause
+
+
+
+
Number
+
Description
+
+
+
+
0
+
unknown
+
+
+
1
+
normal boot
+
+
+
2
+
reset pin
+
+
+
3
+
software reset
+
+
+
4
+
watchdog reset
+
+
+
+
boot mode
+
+
the first value respects the pin setup of the Pins 0, 2 and 15.
I2C library updated to better handle repeated start for certain devices,
+improved waveforms, higher frequencies for 160MHz core clock, fix case where
+using different pins would not work with libs calling begin internally.
+
Add Adafruit HUZZAH board
+
Add SparkFun Thing board
+
Add SweetPea ESP-210 board
+
Add eboot bootloader
+
Timer0 support
+
Add PWM range and frequency control
+
Add ESP.eraseConfig method
+
Fix pin change interrupt handling (#322)
+
Add SLC and I2S register definitions
+
Fix math functions calling themselves recursively (#233, #354)
Rebuild toolchain and esptool with support for OS X down to 10.6.
+
+
+
Libraries
+
+
+
Better connection handling in ESP8266WebServer.
+The server now sends Content-Length and Connection: close headers,
+then waits for the client to disconnect. By not closing the connection
+actively, server avoids TIME_WAIT TCP state, and TCP stack is able to
+release the memory immediately, without waiting for 2xMSL period.
+If the client doesn't disconnect in 2000ms, the server closes the connection
+actively.
+
Add Hash library, which has a function to calculate SHA1 hash.
+
SD, Adafruit_ILI9341, and OneWire libraries are now bundled.
+
Fix incorrect sector calculation in EEPROM library.
+
+
+
+
+
1.6.4-628-g545ffde
+
+
May 19, 2015
+
+
+
Initial release of Boards Manager package for ESP8266 platform.
+
+
+
+
+
diff --git a/versions/2.2.0/doc/eclipse/1_Install_New_Software.png b/versions/2.2.0/doc/eclipse/1_Install_New_Software.png
new file mode 100644
index 000000000..a3e9d3619
Binary files /dev/null and b/versions/2.2.0/doc/eclipse/1_Install_New_Software.png differ
diff --git a/versions/2.2.0/doc/eclipse/2_Install_software.png b/versions/2.2.0/doc/eclipse/2_Install_software.png
new file mode 100644
index 000000000..b7baadaa9
Binary files /dev/null and b/versions/2.2.0/doc/eclipse/2_Install_software.png differ
diff --git a/versions/2.2.0/doc/eclipse/eclipse.md b/versions/2.2.0/doc/eclipse/eclipse.md
new file mode 100644
index 000000000..348d1cf19
--- /dev/null
+++ b/versions/2.2.0/doc/eclipse/eclipse.md
@@ -0,0 +1,38 @@
+using Eclipse with Arduino ESP8266
+===========================================
+
+### What to Download ###
+- [arduino IDE](https://www.arduino.cc/en/Main/Software)
+- [Eclipse IDE for C/C++ Developers](http://www.eclipse.org/downloads/packages/eclipse-ide-cc-developers/marsr)
+- [Java](http://www.java.com/)
+
+### Setup Arduino ###
+ see the [Readme](https://github.com/esp8266/Arduino#installing-with-boards-manager)
+
+### Setup Eclipse ###
+- [step 1](http://www.baeyens.it/eclipse/how_to.shtml#/c)
+- [step 2](http://www.baeyens.it/eclipse/how_to.shtml#/e)
+- go to Window --> preferences --> Arduino
+- add as private hardware path the Part to the ESP8266
+
+###### example private hardware path
+ Windows: C:\Users\[username]\AppData\Roaming\Arduino15\packages\esp8266\hardware
+ Linux: /home/[username]/.arduino15/packages/esp8266/hardware
+
+### Eclipse wont build ###
+if eclipse dont find the path to the Compiler add to the platform.txt
+after:
+```
+version=1.6.4
+```
+this:
+```
+runtime.tools.xtensa-lx106-elf-gcc.path={runtime.platform.path}/../../../tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9
+runtime.tools.esptool.path={runtime.platform.path}/../../../tools/esptool/0.4.4
+```
+Note:
+ - the path may changed, check the current version.
+ - each update over the Arduino IDE will remove the fix
+ - may not needed in future if Eclipse Plugin get an Update
+
+
\ No newline at end of file
diff --git a/versions/2.2.0/doc/eclipse/makefile.init b/versions/2.2.0/doc/eclipse/makefile.init
new file mode 100644
index 000000000..76438d62c
--- /dev/null
+++ b/versions/2.2.0/doc/eclipse/makefile.init
@@ -0,0 +1,39 @@
+vecho := @echo
+Q := @
+
+PROJECT_NAME=project_name
+
+OTA_IP=192.168.254.100
+OTA_PORT=8266
+
+SERIAL_PORT=COM3
+SERIAL_BAUD=230400
+
+ARDUINO_BASE = D:/Coding/avr/Programme/arduino-nightly
+ESP8266_BASE = $(ARDUINO_BASE)/hardware/esp8266com/esp8266
+ESP8266_TOOLS = $(ESP8266_BASE)/tools
+XTENSA_TOOLS_ROOT = $(ESP8266_TOOLS)/xtensa-lx106-elf/bin
+
+PYTHON_BIN = python
+ESPTOOL_PY_BIN = $(ESP8266_TOOLS)/esptool.py
+ESPOTA_PY_BIN = $(ESP8266_TOOLS)/espota.py
+ESPTOOL_BIN = $(ESP8266_TOOLS)/esptool/esptool.exe
+
+ota:
+ $(vecho) ota...
+ $(PYTHON_BIN) $(ESPOTA_PY_BIN) -i $(OTA_IP) -p $(OTA_PORT) --auth= -f ./$(PROJECT_NAME).bin
+
+ota_spiffs:
+ $(vecho) ota spiffs...
+ $(PYTHON_BIN) $(ESPOTA_PY_BIN) -i $(OTA_IP) -p $(OTA_PORT) --auth= -s -f ./$(PROJECT_NAME)_spiffs.bin
+
+erase_flash:
+ $(vecho) "Erase Flash"
+ $(PYTHON_BIN) $(ESPTOOL_PY_BIN) -p $(SERIAL_PORT) -b $(SERIAL_BAUD) erase_flash
+
+dumpmem:
+ $(vecho) "Read Flash need some time..."
+ $(PYTHON_BIN) $(ESPTOOL_PY_BIN) -p $(SERIAL_PORT) -b $(SERIAL_BAUD) read_flash 0 4194304 dump.bin
+
+objdump:
+ "$(XTENSA_TOOLS_ROOT)/xtensa-lx106-elf-objdump" -S $(PROJECT_NAME).elf > $(PROJECT_NAME).dobj
diff --git a/versions/2.2.0/doc/esp12.png b/versions/2.2.0/doc/esp12.png
new file mode 100644
index 000000000..8ec371016
Binary files /dev/null and b/versions/2.2.0/doc/esp12.png differ
diff --git a/versions/2.2.0/doc/esp12.svg b/versions/2.2.0/doc/esp12.svg
new file mode 100644
index 000000000..107073dfa
--- /dev/null
+++ b/versions/2.2.0/doc/esp12.svg
@@ -0,0 +1,1187 @@
+
+
+
+
diff --git a/versions/2.2.0/doc/esp8266_tcp_active_close.png b/versions/2.2.0/doc/esp8266_tcp_active_close.png
new file mode 100644
index 000000000..f9dad0987
Binary files /dev/null and b/versions/2.2.0/doc/esp8266_tcp_active_close.png differ
diff --git a/versions/2.2.0/doc/exception_causes.md b/versions/2.2.0/doc/exception_causes.md
new file mode 100644
index 000000000..4b11bdb13
--- /dev/null
+++ b/versions/2.2.0/doc/exception_causes.md
@@ -0,0 +1,38 @@
+Exception Causes (EXCCAUSE)
+===========================================
+
+| EXC-CAUSE Code | Cause Name | Cause Description | Required Option | EXC-VADDR Loaded |
+|:--------------:|:---------------------------|:------------------------------------------------------------------------------------------------------------|:-------------------------|:----------------:|
+| 0 | IllegalInstructionCause | Illegal instruction | Exception | No |
+| 1 | SyscallCause | SYSCALL instruction | Exception | No |
+| 2 | InstructionFetchErrorCause | Processor internal physical address or data error during instruction fetch | Exception | Yes |
+| 3 | LoadStoreErrorCause | Processor internal physical address or data error during load or store | Exception | Yes |
+| 4 | Level1InterruptCause | Level-1 interrupt as indicated by set level-1 bits in the INTERRUPT register | Interrupt | No |
+| 5 | AllocaCause | MOVSP instruction, if callers registers are not in the register file | Windowed Register | No |
+| 6 | IntegerDivideByZeroCause | QUOS, QUOU, REMS, or REMU divisor operand is zero | 32-bit Integer Divide | No |
+| 7 | Reserved for Tensilica | | | |
+| 8 | PrivilegedCause | Attempt to execute a privileged operation when CRING ? 0 | MMU | No |
+| 9 | LoadStoreAlignmentCause | Load or store to an unaligned address | Unaligned Exception | Yes |
+| 10..11 | Reserved for Tensilica | | | |
+| 12 | InstrPIFDataErrorCause | PIF data error during instruction fetch | Processor Interface | Yes |
+| 13 | LoadStorePIFDataErrorCause | Synchronous PIF data error during LoadStore access | Processor Interface | Yes |
+| 14 | InstrPIFAddrErrorCause | PIF address error during instruction fetch | Processor Interface | Yes |
+| 15 | LoadStorePIFAddrErrorCause | Synchronous PIF address error during LoadStore access | Processor Interface | Yes |
+| 16 | InstTLBMissCause | Error during Instruction TLB refill | MMU | Yes |
+| 17 | InstTLBMultiHitCause | Multiple instruction TLB entries matched | MMU | Yes |
+| 18 | InstFetchPrivilegeCause | An instruction fetch referenced a virtual address at a ring level less than CRING | MMU | Yes |
+| 19 | Reserved for Tensilica | | | |
+| 20 | InstFetchProhibitedCause | An instruction fetch referenced a page mapped with an attribute that does not permit instruction fetch | Region Protection or MMU | Yes |
+| 21..23 | Reserved for Tensilica | | | |
+| 24 | LoadStoreTLBMissCause | Error during TLB refill for a load or store | MMU | Yes |
+| 25 | LoadStoreTLBMultiHitCause | Multiple TLB entries matched for a load or store | MMU | Yes |
+| 26 | LoadStorePrivilegeCause | A load or store referenced a virtual address at a ring level less than CRING | MMU | Yes |
+| 27 | Reserved for Tensilica | | | |
+| 28 | LoadProhibitedCause | A load referenced a page mapped with an attribute that does not permit loads | Region Protection or MMU | Yes |
+| 29 | StoreProhibitedCause | A store referenced a page mapped with an attribute that does not permit stores | Region Protection or MMU | Yes |
+| 30..31 | Reserved for Tensilica | | | |
+| 32..39 | CoprocessornDisabled | Coprocessor n instruction when cpn disabled. n varies 0..7 as the cause varies 32..39 | Coprocessor | No |
+| 40..63 | Reserved | | | |
+
+
+Infos from Xtensa Instruction Set Architecture (ISA) Reference Manual
\ No newline at end of file
diff --git a/versions/2.2.0/doc/filesystem.html b/versions/2.2.0/doc/filesystem.html
new file mode 100644
index 000000000..5d68ad52e
--- /dev/null
+++ b/versions/2.2.0/doc/filesystem.html
@@ -0,0 +1,587 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ File System · ESP8266 Arduino Core
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This documentation is for version 2.2.0. Other versions.
+
Even though file system is stored on the same flash chip as the program, programming new sketch will not modify file system contents. This allows to use file system to store sketch data, configuration files, or content for Web server.
+
+
The following diagram illustrates flash layout used in Arduino environment:
+
|--------------|-------|---------------|--|--|--|--|--|
+^ ^ ^ ^ ^
+Sketch OTA update File system EEPROM WiFi config (SDK)
+
+
File system size depends on the flash chip size. Depending on the board which is selected in IDE, you have the following options for flash size:
+
+
+
+
Board
+
Flash chip size, bytes
+
File system size, bytes
+
+
+
+
Generic module
+
512k
+
64k, 128k
+
+
+
Generic module
+
1M
+
64k, 128k, 256k, 512k
+
+
+
Generic module
+
2M
+
1M
+
+
+
Generic module
+
4M
+
3M
+
+
+
Adafruit HUZZAH
+
4M
+
1M, 3M
+
+
+
ESPresso Lite 1.0
+
4M
+
1M, 3M
+
+
+
ESPresso Lite 2.0
+
4M
+
1M, 3M
+
+
+
NodeMCU 0.9
+
4M
+
1M, 3M
+
+
+
NodeMCU 1.0
+
4M
+
1M, 3M
+
+
+
Olimex MOD-WIFI-ESP8266(-DEV)
+
2M
+
1M
+
+
+
SparkFun Thing
+
512k
+
64k
+
+
+
SweetPea ESP-210
+
4M
+
1M, 3M
+
+
+
WeMos D1 & D1 mini
+
4M
+
1M, 3M
+
+
+
ESPDuino
+
4M
+
1M, 3M
+
+
+
+
Note: to use any of file system functions in the sketch, add the following include to the sketch:
+
#include "FS.h"
+
+
Uploading files to file system
+
+
ESP8266FS is a tool which integrates into the Arduino IDE. It adds a menu item to Tools menu for uploading the contents of sketch data directory into ESP8266 flash file system.
In your Arduino sketchbook directory, create tools directory if it doesn't exist yet
+
Unpack the tool into tools directory (the path will look like <home_dir>/Arduino/tools/ESP8266FS/tool/esp8266fs.jar)
+
Restart Arduino IDE
+
Open a sketch (or create a new one and save it)
+
Go to sketch directory (choose Sketch > Show Sketch Folder)
+
Create a directory named data and any files you want in the file system there
+
Make sure you have selected a board, port, and closed Serial Monitor
+
Select Tools > ESP8266 Sketch Data Upload. This should start uploading the files into ESP8266 flash file system. When done, IDE status bar will display SPIFFS Image Uploaded message.
+
+
+
File system object (SPIFFS)
+
+
begin
+
SPIFFS.begin()
+
+
This method mounts SPIFFS file system. It must be called before any other
+FS APIs are used. Returns true if file system was mounted successfully, false
+otherwise.
+
+
format
+
SPIFFS.format()
+
+
Formats the file system. May be called either before or after calling begin.
+Returns true if formatting was successful.
+
+
open
+
SPIFFS.open(path,mode)
+
+
Opens a file. path should be an absolute path starting with a slash
+(e.g. /dir/filename.txt). mode is a string specifying access mode. It can be
+one of "r", "w", "a", "r+", "w+", "a+". Meaning of these modes is the same as
+for fopen C function.
+
r Open text file for reading. The stream is positioned at the
+ beginning of the file.
+
+ r+ Open for reading and writing. The stream is positioned at the
+ beginning of the file.
+
+ w Truncate file to zero length or create text file for writing.
+ The stream is positioned at the beginning of the file.
+
+ w+ Open for reading and writing. The file is created if it does
+ not exist, otherwise it is truncated. The stream is
+ positioned at the beginning of the file.
+
+ a Open for appending (writing at end of file). The file is
+ created if it does not exist. The stream is positioned at the
+ end of the file.
+
+ a+ Open for reading and appending (writing at end of file). The
+ file is created if it does not exist. The initial file
+ position for reading is at the beginning of the file, but
+ output is always appended to the end of the file.
+
+
Returns File object. To check whether the file was opened successfully, use
+the boolean operator.
+
Filef=SPIFFS.open("/f.txt","w");
+if(!f){
+ Serial.println("file open failed");
+}
+
+
exists
+
SPIFFS.exists(path)
+
+
Returns true if a file with given path exists, false otherwise.
+
+
openDir
+
SPIFFS.openDir(path)
+
+
Opens a directory given its absolute path. Returns a Dir object.
+
+
remove
+
SPIFFS.remove(path)
+
+
Deletes the file given its absolute path. Returns true if file was deleted successfully.
+
+
rename
+
SPIFFS.rename(pathFrom,pathTo)
+
+
Renames file from pathFrom to pathTo. Paths must be absolute. Returns true
+if file was renamed successfully.
+
+
info
+
FSInfofs_info;
+SPIFFS.info(fs_info);
+
+
Fills FSInfo structure with information about
+the file system. Returns true is successful, false otherwise.
This is the structure which may be filled using FS::info method.
+- totalBytes — total size of useful data on the file system
+- usedBytes — number of bytes used by files
+- blockSize — SPIFFS block size
+- pageSize — SPIFFS logical page size
+- maxOpenFiles — max number of files which may be open simultaneously
+- maxPathLength — max file name length (including one byte for zero termination)
+
+
Directory object (Dir)
+
+
The purpose of Dir object is to iterate over files inside a directory.
+It provides three methods: next(), fileName(), and openFile(mode).
+
+
The following example shows how it should be used:
dir.next() returns true while there are files in the directory to iterate over.
+It must be called before calling fileName and openFile functions.
+
+
openFile method takes mode argument which has the same meaning as for SPIFFS.open function.
+
+
File object
+
+
SPIFFS.open and dir.openFile functions return a File object. This object
+supports all the functions of Stream, so you can use readBytes, findUntil,
+parseInt, println, and all other Stream methods.
+
+
There are also some functions which are specific to File object.
+
+
seek
+
file.seek(offset,mode)
+
+
This function behaves like fseek C function. Depending on the value of mode,
+it moves current position in a file as follows:
+
+
+
if mode is SeekSet, position is set to offset bytes from the beginning.
+
if mode is SeekCur, current position is moved by offset bytes.
+
if mode is SeekEnd, position is set to offset bytes from the end of the
+file.
+
+
+
Returns true if position was set successfully.
+
+
position
+
file.position()
+
+
Returns the current position inside the file, in bytes.
+
+
size
+
file.size()
+
+
Returns file size, in bytes.
+
+
name
+
Stringname=file.name();
+
+
Returns file name, as const char*. Convert it to String for storage.
+
+
close
+
file.close()
+
+
Close the file. No other operations should be performed on File object after close function was called.
Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
+
Open Boards Manager from Tools > Board menu and find esp8266 platform.
+
Select the version you need from a drop-down box.
+
Click install button.
+
Don't forget to select your ESP8266 board from Tools > Board menu after installation.
+
+
+
You may optionally use staging boards manager package link:
+http://arduino.esp8266.com/staging/package_esp8266com_index.json. This may contain some new features, but at the same time, some things might be broken.
+
+
Using git version
+
+
This is the suggested installation method for contributors and library developers.
+
+
Prerequisites
+
+
+
Arduino 1.6.8 (or newer, if you know what you are doing)
+
git
+
python 2.7
+
terminal, console, or command prompt (depending on you OS)
+
Internet connection
+
+
+
Instructions
+
+
+
Open the console and go to Arduino directory. This can be either your sketchbook directory (usually <Documents>/Arduino), or the directory of Arduino application itself, the choice is up to you.
+
Clone this repository into hardware/esp8266com/esp8266 directory. Alternatively, clone it elsewhere and create a symlink, if your OS supports them.
This is mostly similar to WiFi shield library. Differences include:
+
+
+
WiFi.mode(m): set mode to WIFI_AP, WIFI_STA, WIFI_AP_STA or WIFI_OFF.
+
call WiFi.softAP(ssid) to set up an open network
+
call WiFi.softAP(ssid, password) to set up a WPA2-PSK network (password should be at least 8 characters)
+
WiFi.macAddress(mac) is for STA, WiFi.softAPmacAddress(mac) is for AP.
+
WiFi.localIP() is for STA, WiFi.softAPIP() is for AP.
+
WiFi.printDiag(Serial) will print out some diagnostic info
+
WiFiUDP class supports sending and receiving multicast packets on STA interface.
+When sending a multicast packet, replace udp.beginPacket(addr, port) with
+udp.beginPacketMulticast(addr, port, WiFi.localIP()).
+When listening to multicast packets, replace udp.begin(port) with
+udp.beginMulticast(WiFi.localIP(), multicast_ip_addr, port).
+You can use udp.destinationIP() to tell whether the packet received was
+sent to the multicast or unicast address.
+
+
+
WiFiServer, WiFiClient, and WiFiUDP behave mostly the same way as with WiFi shield library.
+Four samples are provided for this library.
+You can see more commands here: http://www.arduino.cc/en/Reference/WiFi
+
+
Ticker
+
+
Library for calling functions repeatedly with a certain period. Two examples included.
+
+
It is currently not recommended to do blocking IO operations (network, serial, file) from Ticker
+callback functions. Instead, set a flag inside the ticker callback and check for that flag inside the loop function.
+
+
Here is library to simplificate Ticker usage and avoid WDT reset: TickerScheduler
+
+
EEPROM
+
+
This is a bit different from standard EEPROM class. You need to call EEPROM.begin(size)
+before you start reading or writing, size being the number of bytes you want to use.
+Size can be anywhere between 4 and 4096 bytes.
+
+
EEPROM.write does not write to flash immediately, instead you must call EEPROM.commit()
+whenever you wish to save changes to flash. EEPROM.end() will also commit, and will
+release the RAM copy of EEPROM contents.
+
+
EEPROM library uses one sector of flash located just after the SPIFFS.
+
+
Three examples included.
+
+
I2C (Wire library)
+
+
Wire library currently supports master mode up to approximately 450KHz.
+Before using I2C, pins for SDA and SCL need to be set by calling
+Wire.begin(int sda, int scl), i.e. Wire.begin(0, 2) on ESP-01,
+else they default to pins 4(SDA) and 5(SCL).
+
+
SPI
+
+
SPI library supports the entire Arduino SPI API including transactions, including setting phase (CPHA).
+Setting the Clock polarity (CPOL) is not supported, yet (SPI_MODE2 and SPI_MODE3 not working).
+
+
SoftwareSerial
+
+
An ESP8266 port of SoftwareSerial library done by Peter Lerup (@plerup) supports baud rate up to 115200 and multiples SoftwareSerial instances. See https://github.com/plerup/espsoftwareserial if you want to suggest an improvement or open an issue related to SoftwareSerial.
+
+
ESP-specific APIs
+
+
APIs related to deep sleep and watchdog timer are available in the ESP object, only available in Alpha version.
+
+
ESP.deepSleep(microseconds, mode) will put the chip into deep sleep. mode is one of WAKE_RF_DEFAULT, WAKE_RFCAL, WAKE_NO_RFCAL, WAKE_RF_DISABLED. (GPIO16 needs to be tied to RST to wake from deepSleep.)
+
+
ESP.restart() restarts the CPU.
+
+
ESP.getResetReason() returns String containing the last reset resaon in human readable format.
+
+
ESP.getFreeHeap() returns the free heap size.
+
+
ESP.getChipId() returns the ESP8266 chip ID as a 32-bit integer.
+
+
Several APIs may be used to get flash chip info:
+
+
ESP.getFlashChipId() returns the flash chip ID as a 32-bit integer.
+
+
ESP.getFlashChipSize() returns the flash chip size, in bytes, as seen by the SDK (may be less than actual size).
+
+
ESP.getFlashChipSpeed(void) returns the flash chip frequency, in Hz.
+
+
ESP.getCycleCount() returns the cpu instruction cycle count since start as an unsigned 32-bit. This is useful for accurate timing of very short actions like bit banging.
+
+
ESP.getVcc() may be used to measure supply voltage. ESP needs to reconfigure the ADC
+at startup in order for this feature to be available. Add the following line to the top
+of your sketch to use getVcc:
+
ADC_MODE(ADC_VCC);
+
+
TOUT pin has to be disconnected in this mode.
+
+
Note that by default ADC is configured to read from TOUT pin using analogRead(A0), and
+ESP.getVCC() is not available.
+
+
mDNS and DNS-SD responder (ESP8266mDNS library)
+
+
Allows the sketch to respond to multicast DNS queries for domain names like "foo.local", and DNS-SD (service dicovery) queries.
+See attached example for details.
+
+
SSDP responder (ESP8266SSDP)
+
+
SSDP is another service discovery protocol, supported on Windows out of the box. See attached example for reference.
+
+
DNS server (DNSServer library)
+
+
Implements a simple DNS server that can be used in both STA and AP modes. The DNS server currently supports only one domain (for all other domains it will reply with NXDOMAIN or custom status code). With it clients can open a web server running on ESP8266 using a domain name, not an IP address.
+See attached example for details.
+
+
Servo
+
+
This library exposes the ability to control RC (hobby) servo motors. It will support upto 24 servos on any available output pin. By defualt the first 12 servos will use Timer0 and currently this will not interfere with any other support. Servo counts above 12 will use Timer1 and features that use it will be effected.
+While many RC servo motors will accept the 3.3V IO data pin from a ESP8266, most will not be able to run off 3.3v and will require another power source that matches their specifications. Make sure to connect the grounds between the ESP8266 and the servo motor power supply.
+
+
Other libraries (not included with the IDE)
+
+
Libraries that don't rely on low-level access to AVR registers should work well. Here are a few libraries that were verified to work:
DHT-sensor-library - Arduino library for the DHT11/DHT22 temperature and humidity sensors. Download latest v1.1.1 library and no changes are necessary. Older versions should initialize DHT as follows: DHT dht(DHTPIN, DHTTYPE, 15)
+
DimSwitch - Control electronic dimmable ballasts for fluorescent light tubes remotely as if using a wall switch.
+
Encoder - Arduino library for rotary encoders. Version 1.4 supports ESP8266.
+
esp8266_mdns - mDNS queries and responses on esp8266. Or to describe it another way: An mDNS Client or Bonjour Client library for the esp8266.
+
ESPAsyncTCP - Asynchronous TCP Library for ESP8266 and ESP32/31B
+
ESPAsyncWebServer - Asynchronous Web Server Library for ESP8266 and ESP32/31B
+
Homie for ESP8266 - Arduino framework for ESP8266 implementing Homie, an MQTT convention for the IoT.
+
NeoPixel - Adafruit's NeoPixel library, now with support for the ESP8266 (use version 1.0.2 or higher from Arduino's library manager).
+
NeoPixelBus - Arduino NeoPixel library compatible with ESP8266. Use the "DmaDriven" or "UartDriven" branches for ESP8266. Includes HSL color support and more.
RTC - Arduino Library for Ds1307 & Ds3231 compatible with ESP8266.
+
Souliss, Smart Home - Framework for Smart Home based on Arduino, Android and openHAB.
+
ST7735 - Adafruit's ST7735 library modified to be compatible with ESP8266. Just make sure to modify the pins in the examples as they are still AVR specific.
+
Task - Arduino Nonpreemptive multitasking library. While similiar to the included Ticker library in the functionality provided, this library was meant for cross Arduino compatibility.
+
TickerScheduler - Library provides simple scheduler for Ticker to avoid WDT reset
+
Teleinfo - Generic French Power Meter library to read Teleinfo energy monitoring data such as consuption, contract, power, period, ... This library is cross platform, ESP8266, Arduino, Particle, and simple C++. French dedicated post on author's blog and all related information about Teleinfo also available.
+
UTFT-ESP8266 - UTFT display library with support for ESP8266. Only serial interface (SPI) displays are supported for now (no 8-bit parallel mode, etc). Also includes support for the hardware SPI controller of the ESP8266.
+
WiFiManager - WiFi Connection manager with web captive portal. If it can't connect, it starts AP mode and a configuration portal so you can choose and enter WiFi credentials.
SdFat-beta - SD-card library with support for long filenames, software- and hardware-based SPI and lots more.
+
FastLED - a library for easily & efficiently controlling a wide variety of LED chipsets, like the Neopixel (WS2812B), DotStar, LPD8806 and many more. Includes fading, gradient, color conversion functions.
+
OLED - a library for controlling I2C connected OLED displays. Tested with 0.96 inch OLED graphics display.
+
+
+
+
+
diff --git a/versions/2.2.0/doc/ota_updates/a-ota-external-serial-terminal-output.png b/versions/2.2.0/doc/ota_updates/a-ota-external-serial-terminal-output.png
new file mode 100644
index 000000000..cc36c7d05
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/a-ota-external-serial-terminal-output.png differ
diff --git a/versions/2.2.0/doc/ota_updates/a-ota-network-terminal.png b/versions/2.2.0/doc/ota_updates/a-ota-network-terminal.png
new file mode 100644
index 000000000..9b9bd47f4
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/a-ota-network-terminal.png differ
diff --git a/versions/2.2.0/doc/ota_updates/a-ota-ota-port-selection.png b/versions/2.2.0/doc/ota_updates/a-ota-ota-port-selection.png
new file mode 100644
index 000000000..057bdb706
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/a-ota-ota-port-selection.png differ
diff --git a/versions/2.2.0/doc/ota_updates/a-ota-ota-upload-complete.png b/versions/2.2.0/doc/ota_updates/a-ota-ota-upload-complete.png
new file mode 100644
index 000000000..85f8ba56e
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/a-ota-ota-upload-complete.png differ
diff --git a/versions/2.2.0/doc/ota_updates/a-ota-ota-upload-configuration.png b/versions/2.2.0/doc/ota_updates/a-ota-ota-upload-configuration.png
new file mode 100644
index 000000000..1d31a784c
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/a-ota-ota-upload-configuration.png differ
diff --git a/versions/2.2.0/doc/ota_updates/a-ota-python-configuration.png b/versions/2.2.0/doc/ota_updates/a-ota-python-configuration.png
new file mode 100644
index 000000000..0e78f72a1
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/a-ota-python-configuration.png differ
diff --git a/versions/2.2.0/doc/ota_updates/a-ota-serial-upload-configuration.png b/versions/2.2.0/doc/ota_updates/a-ota-serial-upload-configuration.png
new file mode 100644
index 000000000..89f969d43
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/a-ota-serial-upload-configuration.png differ
diff --git a/versions/2.2.0/doc/ota_updates/a-ota-sketch-selection.png b/versions/2.2.0/doc/ota_updates/a-ota-sketch-selection.png
new file mode 100644
index 000000000..50ef7ca51
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/a-ota-sketch-selection.png differ
diff --git a/versions/2.2.0/doc/ota_updates/a-ota-ssid-pass-entry.png b/versions/2.2.0/doc/ota_updates/a-ota-ssid-pass-entry.png
new file mode 100644
index 000000000..3b678416c
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/a-ota-ssid-pass-entry.png differ
diff --git a/versions/2.2.0/doc/ota_updates/a-ota-upload-complete-and-joined-wifi.png b/versions/2.2.0/doc/ota_updates/a-ota-upload-complete-and-joined-wifi.png
new file mode 100644
index 000000000..479335d90
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/a-ota-upload-complete-and-joined-wifi.png differ
diff --git a/versions/2.2.0/doc/ota_updates/a-ota-upload-password-authenticating-ok.png b/versions/2.2.0/doc/ota_updates/a-ota-upload-password-authenticating-ok.png
new file mode 100644
index 000000000..052d0da8b
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/a-ota-upload-password-authenticating-ok.png differ
diff --git a/versions/2.2.0/doc/ota_updates/a-ota-upload-password-passing-again-upload-ok.png b/versions/2.2.0/doc/ota_updates/a-ota-upload-password-passing-again-upload-ok.png
new file mode 100644
index 000000000..cc6ea94dc
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/a-ota-upload-password-passing-again-upload-ok.png differ
diff --git a/versions/2.2.0/doc/ota_updates/a-ota-upload-password-passing-upload-ok.png b/versions/2.2.0/doc/ota_updates/a-ota-upload-password-passing-upload-ok.png
new file mode 100644
index 000000000..e9254ebec
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/a-ota-upload-password-passing-upload-ok.png differ
diff --git a/versions/2.2.0/doc/ota_updates/a-ota-upload-password-prompt.png b/versions/2.2.0/doc/ota_updates/a-ota-upload-password-prompt.png
new file mode 100644
index 000000000..e3ecb520d
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/a-ota-upload-password-prompt.png differ
diff --git a/versions/2.2.0/doc/ota_updates/ota-web-browser-form-ok.png b/versions/2.2.0/doc/ota_updates/ota-web-browser-form-ok.png
new file mode 100644
index 000000000..ed44e9cbb
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/ota-web-browser-form-ok.png differ
diff --git a/versions/2.2.0/doc/ota_updates/ota-web-browser-form.png b/versions/2.2.0/doc/ota_updates/ota-web-browser-form.png
new file mode 100644
index 000000000..87872393f
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/ota-web-browser-form.png differ
diff --git a/versions/2.2.0/doc/ota_updates/ota-web-path-to-binary.png b/versions/2.2.0/doc/ota_updates/ota-web-path-to-binary.png
new file mode 100644
index 000000000..9237d8780
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/ota-web-path-to-binary.png differ
diff --git a/versions/2.2.0/doc/ota_updates/ota-web-serial-monitor-ready.png b/versions/2.2.0/doc/ota_updates/ota-web-serial-monitor-ready.png
new file mode 100644
index 000000000..5ce011170
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/ota-web-serial-monitor-ready.png differ
diff --git a/versions/2.2.0/doc/ota_updates/ota-web-serial-monitor-reboot.png b/versions/2.2.0/doc/ota_updates/ota-web-serial-monitor-reboot.png
new file mode 100644
index 000000000..0fd469e11
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/ota-web-serial-monitor-reboot.png differ
diff --git a/versions/2.2.0/doc/ota_updates/ota-web-show-verbose-compilation.png b/versions/2.2.0/doc/ota_updates/ota-web-show-verbose-compilation.png
new file mode 100644
index 000000000..00ac3871f
Binary files /dev/null and b/versions/2.2.0/doc/ota_updates/ota-web-show-verbose-compilation.png differ
diff --git a/versions/2.2.0/doc/ota_updates/readme.html b/versions/2.2.0/doc/ota_updates/readme.html
new file mode 100644
index 000000000..cd595aa09
--- /dev/null
+++ b/versions/2.2.0/doc/ota_updates/readme.html
@@ -0,0 +1,757 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OTA Update · ESP8266 Arduino Core
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This documentation is for version 2.2.0. Other versions.
+
OTA (Over the Air) update is the process of loading the firmware to ESP module using Wi-Fi connection rather that a serial port. Such functionality became extremely useful in case of limited or no physical access to the module.
Arduino IDE option is intended primarily for software development phase. The two other options would be more useful after deployment, to provide module with application updates manually with a web browser or automatically using a http server.
+
+
In any case first firmware upload have to be done over a serial port. If OTA routines are correctly implemented in a sketch, then all subsequent uploads may be done over the air.
+
+
There is no imposed security on OTA process from being hacked. It is up to developer to ensure that updates are allowed only from legitimate / trusted source. Once update is complete, module restarts and new code is executed. Developer should ensure that application running on module is shut down and restarted in a safe manner. Chapters below provide additional information regarding security and safety of OTA process.
+
+
Security
+
+
Module has to be exposed wirelessly to get it updated with a new sketch. That poses chances of module being violently hacked and loaded with some other code. To reduce likelihood of being hacked consider protecting your uploads with a password, selecting certain OTA port, etc.
+
+
Check functionality provided with ArduinoOTA library that may improve security:
Certain protection functionality is already built in and do not require any additional coding by developer. ArduinoOTA and espota.py use Digest-MD5 to authenticate upload. Integrity of transferred data is verified on ESP side using MD5 checksum.
+
+
Make your own risk analysis and depending on application decide what library functions to implement. If required consider implementation of other means of protection from being hacked, e.g. exposing module for uploads only according to specific schedule, trigger OTA only be user pressing dedicated “Update” button, etc.
+
+
Safety
+
+
OTA process takes ESP’s resources and bandwidth during upload. Then module is restarted and a new sketch executed. Analyse and test how it affects functionality of your existing and new sketch.
+
+
If ESP is placed in remote location and controlling some equipment, you should put additional attention what happens if operation of this equipment is suddenly interrupted by update process. Therefore decide how to put this equipment into safe state before starting the update. For instance your module may be controlling a garden watering system in a sequence. If this sequence is not properly shut down and a water valve left open, your garden may be flooded if this valve is not closed after OTA is finished and module restarts.
+
+
The following functions are provided with ArduinoOTA library and intended to handle functionality of your application during specific stages of OTA or on an OTA error:
Flash chip size needs a size that is able to hold the old sketch (currently running) and the new sketch (OTA) at the same time.
+Keep in mind that the File system and EEPROM for example needs space too (one time) see flash layout.
+cpp
+ESP.getFreeSketchSpace();
+
+can be used for checking the free space for the new sketch.
+
+
For overview of memory layout, where new sketch is stored and how it is copied during OTA process see Update process - memory view.
+
+
The following chapters provide more details and specific methods of doing OTA.
+
+
Arduino IDE
+
+
Uploading modules wirelessly from Arduino IDE is intended for the following typical scenarios:
+- during firmware development as a quicker alternative to loading over a serial
+- for updating small quantity of modules
+- only if modules are available on the same network as the computer with Arduino IDE
+
+
Requirements
+
+
+
The ESP and the computer must be connected to the same network.
+
+
+
Application Example
+
+
Instructions below show configuration of OTA on NodeMCU 1.0 (ESP-12E Module) board. You can use any other board assuming that it meets requirements described above. This instruction is valid for all operating systems supported by Arduino IDE. Screen captures have been made on Windows 7 and you may see small differences (like name of serial port) if you are using Linux and MacOS.
+
+
+
Before you begin, please make sure that you have the following s/w installed:
Note: Windows users should select “Add python.exe to Path” (see below – this option is not selected by default).
+
+
+
+
Now prepare the sketch and configuration for the upload over a serial port.
+
+
+
Start Arduino IDE and load sketch BasicOTA.ino available under File > Examples > ArduinoOTA
+
+
+
+
- Update SSID and password in the sketch so the module can join your Wi-Fi network
+ 
+
+- Configure upload parameters as below (you may need to adjust configuration if you are using a different module):
+ 
+
+ **Note:** Depending on version of platform package and board you have, you may see ``` Upload Using: ``` in the menu above. This option is inactive and it does not matter what you select. It has been left for compatibility with older implementation of OTA and is targeted for removal in platform package version 2.2.0.
+
+
+
Upload the sketch (Ctrl+U). Once done, open Serial Monitor (Ctrl+Shift+M) and check if module has joined your Wi-Fi network:
+
+
+
Only if module is connected to network, after a couple of seconds, the esp8266-ota port will show up in Arduino IDE. Select port with IP adress shown in Serial Monitor in previus step:
+
+
+
+
Note: If OTA port does not show up, exit Arduino IDE, open it again and check if port is there. If it does not help check your firewall settings.
+
Now get ready for your first OTA upload by selecting the OTA port:
+
+
+
+
Note: The menu entry Upload Speed: does not matter at this point as it concerns the serial port. Just left it unchanged.
+
If you have successfully completed all the above steps, you can upload (Ctrl+U) the same (or any other) sketch over OTA:
+
+
+
+
+
Note: To be able to upload your sketch over and over again using OTA, you need to embed OTA routines inside. Please use BasicOTA.ino as an example.
+
+
Password Protection
+
+
Protecting your OTA uploads with password is really straightforward. All you need to do, is to include the following statement in your code:
+
ArduinoOTA.setPassword((constchar*)"123");
+
+
Where 123 is a sample password that you should replace with your own.
+
+
Before implementing it in your sketch, it is a good idea to check how it works using BasicOTA.ino sketch available under File > Examples > ArduinoOTA. Go ahead, open BasicOTA.ino, uncomment the above statement that is already there, and upload the sketch. To make troubleshooting easier, do not modify example sketch besides what is absolutely required. This is including original simple 123 OTA password. Then attempt to upload sketch again (using OTA). After compilation is complete, once upload is about to begin, you should see prompt for password as follows:
+
+
+
+
Enter the password and upload should be initiated as usual with the only difference being Authenticating...OK message visible in upload log.
+
+
+
+
You will not be prompted for a reentering the same password next time. Arduino IDE will remember it for you. You will see prompt for password only after reopening IDE, or if you change it in your sketch, upload the sketch and then try to upload it again.
+
+
Please note, it is possible to reveal password entered previously in Arduino IDE, if IDE has not been closed since last upload. This can be done by enabling Show verbose output during: upload in File > Preferences and attempting to upload the module.
+
+
+
+
The picture above shows that the password is visible in log as it is passed to espota.py upload script.
+
+
Another example below shows situation when password is changed between uploads.
+
+
+
+
When uploading, Arduino IDE used previously entered password, so the upload failed and that has been clearly reported by IDE. Only then IDE prompted for a new password. That was entered correctly and second attempt to upload has been successful.
+
+
Troubleshooting
+
+
If OTA update fails, first step is to check for error messages that may be shown in upload window of Arduino IDE. If this is not providing any useful hints try to upload again while checking what is shown by ESP on serial port. Serial Monitor from IDE will not be useful in that case. When attempting to open it, you will likely see the following:
+
+
+
+
This window is for Arduino Yún and not yet implemented for esp8266/Arduino. It shows up because IDE is attempting to open Serial Monitor using network port you have selected for OTA upload.
+
+
Instead you need an external serial monitor. If you are a Windows user check out Termite. This is handy, slick and simple RS232 terminal that does not impose RTS or DTR flow control. Such flow control may cause issues if you are using respective lines to toggle GPIO0 and RESET pins on ESP for upload.
+
+
Select COM port and baud rate on external terminal program as if you were using Arduino Serial Monitor. Please see typical settings for Termite below:
+
+
+
+
Then run OTA from IDE and look what is displayed on terminal. Successful ArduinoOTA process using BasicOTA.ino sketch looks like below (IP address depends on your network configuration):
+
+
+
+
If upload fails you will likely see errors caught by the uploader, exception and the stack dump, or both.
+
+
The most common causes of OTA failure are as follows:
+* not enough physical memory on the chip (e.g. ESP01 with 512K flash memory is not enough for OTA),
+* too much memory declared for SPIFFS so new sketch will not fit between existing sketch and SPIFFS – see Update process - memory view,
+* too little memory declared in Arduino IDE for your selected board (i.e. less than physical size).
+
+
For more details regarding flash memory layout please check File system.
+For overview where new sketch is stored, how it is copied and how memory is organized for the purpose of OTA see Update process - memory view.
+
+
Web Browser
+
+
Updates described in this chapter are done with a web browser that can be useful in the following typical scenarios:
+
+
+
after application deployment if loading directly from Arduino IDE is inconvenient or not possible
+
after deployment if user is unable to expose module for OTA from external update server
+
to provide updates after deployment to small quantity of modules when setting an update server is not practicable
+
+
+
Requirements
+
+
+
The ESP and the computer must be connected to the same network.
+
+
+
Implementation Overview
+
+
Updates with a web browser are implemented using ESP8266HTTPUpdateServer class together with ESP8266WebServer and ESP8266mDNS classes. The following code is required to get it work:
Mac OSX and iOS - support is already built in / no any extra s/w is required
+
+
+
Prepare the sketch and configuration for initial upload with a serial port.
+
+
+
Start Arduino IDE and load sketch WebUpdater.ino available under File > Examples > ESP8266HTTPUpdateServer.
+
Update SSID and password in the sketch so the module can join your Wi-Fi network.
+
Open File > Preferences, look for “Show verbose output during:” and check out “compilation” option.
+
+
+
+
Note: This setting will be required in step 5 below. You can uncheck this setting afterwards.
+
+
Upload sketch (Ctrl+U). Once done open Serial Monitor (Ctrl+Shift+M) and check if you see the following message displayed, that contains url for OTA update.
+
+
+
+
Note: Such message will be shown only after module successfully joins network and is ready for an OTA upload.
+
Now open web browser and enter the url provided on Serial Monitor, i.e. http://esp8266-webupdate.local/update. Once entered, browser should display a form like below that has been served by your module. The form invites you to choose a file for update.
+
+
+
+
Note: If entering http://esp8266-webupdate.local/update does not work, try replacing esp8266-webupdate with module’s IP address. For example, if your module IP is 192.168.1.100 then url should be http://192.168.1.100/update. This workaround is useful in case the host software installed in step 2 does not work. If still nothing works and there are no clues on Serial Monitor, try to diagnose issue by opening provided url in Google Chrome, pressing F12 and checking contents of “Console” and “Network” tabs. Chrome provides some advanced logging on these tabs.
+
To obtain the file navigate to directory used by Arduino IDE to store results of compilation. You can check the path to this file in compilation log shown in IDE debug window as marked below.
+
+
+
Now press “Choose File” in web browser, go to directory identified in step 5 above, find the file “WebUpdater.cpp.bin” and upload it. If upload is successful you will see “OK” on web browser like below.
+
+
+
+
Module will reboot that should be visible on Serial Monitor:
+
+
+
+
Just after reboot you should see exactly the same message HTTPUpdateServer ready! Open http:// esp8266-webupdate.local /update in your browser like in step 3. This is because module has been loaded again with the same code – first using serial port, and then using OTA.
+
+
+
Once you are comfortable with this procedure go ahead and modify WebUpdater.ino sketch to print some additional messages, compile it, locate new binary file and upload it using web browser to see entered changes on a Serial Monitor.
+
+
You can also add OTA routines to your own sketch following guidelines in Implementation Overview above. If this is done correctly you should be always able to upload new sketch over the previous one using a web browser.
+
+
In case OTA update fails dead after entering modifications in your sketch, you can always recover module by loading it over a serial port. Then diagnose the issue with sketch using Serial Monitor. Once the issue is fixed try OTA again.
+
+
HTTP Server
+
+
ESPhttpUpdate class can check for updates and download a binary file from HTTP web server.
+It is possible to download updates from every IP or domain address on the network or Internet.
+
+
Requirements
+
+
+
web server
+
+
+
Arduino code
+
+
Simple updater
+
+
Simple updater downloads the file every time the function is called.
Its possible to point update function to a script at the server.
+If version string argument is given, it will be sent to the server.
+Server side script can use this to check if update should be performed.
+
+
Server side script can respond as follows:
+- response code 200, and send the firmware image,
+- or response code 304 to notify ESP that no update is required.
+
t_httpUpdate_returnret=ESPhttpUpdate.update("192.168.0.2",80,"/esp/update/arduino.php","optional current version string here");
+switch(ret){
+ caseHTTP_UPDATE_FAILED:
+ Serial.println("[update] Update failed.");
+ break;
+ caseHTTP_UPDATE_NO_UPDATES:
+ Serial.println("[update] Update no Update.");
+ break;
+ caseHTTP_UPDATE_OK:
+ Serial.println("[update] Update ok.");// may not called we reboot the ESP
+ break;
+}
+
+
Server request handling
+
+
Simple updater
+
+
For the simple updater the server only needs to deliver the binary file for update.
+
+
Advanced updater
+
+
For advanced update management a script needs to run at the server side, for example a PHP script.
+At every update request the ESP sends some information in HTTP headers to the server.
With this information the script now can check if an update is needed. It is also possible to deliver different binaries based on the MAC address for example.
The Stream Interface is the base for all other update modes like OTA, http Server / client.
+
+
Updater class
+
+
Updater is in the Core and deals with writing the firmware to the flash,
+checking its integrity and telling the bootloader to load the new firmware on the next boot.
+
+
Update process - memory view
+
+
+
The new sketch will be stored in the space between the old sketch and the spiff.
+
on the next reboot the "eboot" bootloader check for commands.
Pin numbers in Arduino correspond directly to the ESP8266 GPIO pin numbers. pinMode, digitalRead, and digitalWrite functions work as usual, so to read GPIO2, call digitalRead(2).
+
+
Digital pins 0—15 can be INPUT, OUTPUT, or INPUT_PULLUP.
+Pin 16 can be INPUT, OUTPUT or INPUT_PULLDOWN_16. At startup, pins are configured as INPUT.
+
+
Pins may also serve other functions, like Serial, I2C, SPI. These functions are normally activated by the corresponding library. The diagram below shows pin mapping for the popular ESP-12 module.
+
+
+
+
Digital pins 6—11 are not shown on this diagram because they are used to connect flash memory chip on most modules. Trying to use these pins as IOs will likely cause the program to crash.
+
+
Note that some boards and modules (ESP-12ED, NodeMCU 1.0) also break out pins 9 and 11. These may be used as IO if flash chip works in DIO mode (as opposed to QIO, which is the default one).
+
+
Pin interrupts are supported through attachInterrupt, detachInterrupt functions.
+Interrupts may be attached to any GPIO pin, except GPIO16. Standard Arduino interrupt
+types are supported: CHANGE, RISING, FALLING.
+
+
Analog input
+
+
ESP8266 has a single ADC channel available to users. It may be used either to read voltage at ADC pin, or to read module supply voltage (VCC).
+
+
To read external voltage applied to ADC pin, use analogRead(A0). Input voltage range is 0 — 1.0V.
+
+
To read VCC voltage, use ESP.getVcc() and ADC pin must be kept unconnected. Additionally, the following line has to be added to the sketch:
+
ADC_MODE(ADC_VCC);
+
+
This line has to appear outside of any functions, for instance right after the #include lines of your sketch.
+
+
Analog output
+
+
analogWrite(pin, value) enables software PWM on the given pin. PWM may be used on pins 0 to 16.
+Call analogWrite(pin, 0) to disable PWM on the pin. value may be in range from 0 to PWMRANGE, which is equal to 1023 by default. PWM range may be changed by calling analogWriteRange(new_range).
+
+
PWM frequency is 1kHz by default. Call analogWriteFreq(new_frequency) to change the frequency.
+
+
Timing and delays
+
+
millis() and micros() return the number of milliseconds and microseconds elapsed after reset, respectively.
+
+
delay(ms) pauses the sketch for a given number of milliseconds and allows WiFi and TCP/IP tasks to run.
+delayMicroseconds(us) pauses for a given number of microseconds.
+
+
Remember that there is a lot of code that needs to run on the chip besides the sketch
+when WiFi is connected. WiFi and TCP/IP libraries get a chance to handle any pending
+events each time the loop() function completes, OR when delay is called.
+If you have a loop somewhere in your sketch that takes a lot of time (>50ms) without
+calling delay, you might consider adding a call to delay function to keep the WiFi
+stack running smoothly.
+
+
There is also a yield() function which is equivalent to delay(0). The delayMicroseconds
+function, on the other hand, does not yield to other tasks, so using it for delays
+more than 20 milliseconds is not recommended.
+
+
Serial
+
+
Serial object works much the same way as on a regular Arduino. Apart from hardware FIFO (128 bytes for TX and RX) HardwareSerial has additional 256-byte TX and RX buffers. Both transmit and receive is interrupt-driven. Write and read functions only block the sketch execution when the respective FIFO/buffers are full/empty.
+
+
Serial uses UART0, which is mapped to pins GPIO1 (TX) and GPIO3 (RX). Serial may be remapped to GPIO15 (TX) and GPIO13 (RX) by calling Serial.swap() after Serial.begin. Calling swap again maps UART0 back to GPIO1 and GPIO3.
+
+
Serial1 uses UART1, TX pin is GPIO2. UART1 can not be used to receive data because normally it's RX pin is occupied for flash chip connection. To use Serial1, call Serial1.begin(baudrate).
+
+
If Serial1 is not used and Serial is not swapped - TX for UART0 can be mapped to GPIO2 instead by calling Serial.set_tx(2) after Serial.begin or directly with Serial.begin(baud, config, mode, 2).
+
+
By default the diagnostic output from WiFi libraries is disabled when you call Serial.begin. To enable debug output again, call Serial.setDebugOutput(true). To redirect debug output to Serial1 instead, call Serial1.setDebugOutput(true).
+
+
You also need to use Serial.setDebugOutput(true) to enable output from printf() function.
+
+
Both Serial and Serial1 objects support 5, 6, 7, 8 data bits, odd (O), even (E), and no (N) parity, and 1 or 2 stop bits. To set the desired mode, call Serial.begin(baudrate, SERIAL_8N1), Serial.begin(baudrate, SERIAL_6E2), etc.
+
+
Progmem
+
+
The Program memory features work much the same way as on a regular Arduino; placing read only data and strings in read only memory and freeing heap for your application.
+The important difference is that on the ESP8266 the literal strings are not pooled. This means that the same literal string defined inside a F("") and/or PSTR("") will take up space for each instance in the code. So you will need to manage the duplicate strings yourself.
+
+
There is one additional helper macro to make it easier to pass const PROGMEM strings to methods that take a __FlashStringHelper called FPSTR(). The use of this will help make it easier to pool strings.
+Not pooling strings...
" + header.innerHTML + "";
+ else if (this_level <= level){ // higher level than before; end parent ol
+ for(i = this_level; i < level; i++) {
+ html += "
"+settings.listType+">"
+ }
+ html += "
" + header.innerHTML + "";
+ }
+ else if (this_level > level) { // lower level than before; expand the previous to contain a ol
+ for(i = this_level; i > level; i--) {
+ html += "<"+settings.listType+">
"
+ }
+ html += "" + header.innerHTML + "";
+ }
+ level = this_level; // update for the next one
+ });
+ html += ""+settings.listType+">";
+ if (!settings.noBackToTopLinks) {
+ $(document).on('click', '.back-to-top', function() {
+ $(window).scrollTop(0);
+ window.location.hash = '';
+ });
+ }
+
+ render[settings.showEffect]();
+ };
+})(jQuery);
diff --git a/versions/2.2.0/ver_index.html b/versions/2.2.0/ver_index.html
new file mode 100644
index 000000000..e69de29bb