Skip to content

Commit 866921c

Browse files
committedNov 23, 2015
Documentation update
1 parent 3d26810 commit 866921c

File tree

9 files changed

+643
-520
lines changed

9 files changed

+643
-520
lines changed
 

β€Ždoc/boards.md

+48-35
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,36 @@
22
title: Supported Hardware
33
---
44

5-
- [Adafruit HUZZAH ESP8266 (ESP-12)](#adafruit-huzzah-esp8266-esp-12)
6-
- [NodeMCU 0.9](#nodemcu-0-9)
7-
- [NodeMCU 1.0](#nodemcu-1-0)
8-
- [Olimex MOD-WIFI-ESP8266-DEV](#olimex-mod-wifi-esp8266-dev)
9-
- [Olimex MOD-WIFI-ESP8266](#olimex-mod-wifi-esp8266)
10-
- [SparkFun ESP8266 Thing](#sparkfun-esp8266-thing)
11-
- [SweetPea ESP-210](#sweetpea-esp-210)
12-
- [Generic ESP8266 modules](#generic-esp8266-modules)
13-
- [WeMos D1](#wemos-d1)
14-
- [WeMos D1 mini](#wemos-d1-mini)
15-
16-
### Adafruit HUZZAH ESP8266 (ESP-12)
5+
## Table of contents
6+
* [Adafruit HUZZAH ESP8266 (ESP\-12)](#adafruit-huzzah-esp8266-esp-12)
Has a comment. Original line has a comment.
7+
* [NodeMCU 0\.9 <a name="user\-content\-nodemcu\-0\-9"></a>](#nodemcu-09-)
8+
* [Pin mapping](#pin-mapping)
9+
* [NodeMCU 1\.0](#nodemcu-10)
10+
* [Olimex MOD\-WIFI\-ESP8266\-DEV](#olimex-mod-wifi-esp8266-dev)
11+
* [Olimex MOD\-WIFI\-ESP8266](#olimex-mod-wifi-esp8266)
12+
* [SparkFun ESP8266 Thing](#sparkfun-esp8266-thing)
13+
* [SweetPea ESP\-210](#sweetpea-esp-210)
14+
* [Generic ESP8266 modules](#generic-esp8266-modules)
15+
* [Serial Adapter](#serial-adapter)
16+
* [Minimal Hardware Setup for Bootloading and Usage](#minimal-hardware-setup-for-bootloading-and-usage)
17+
* [ESP to Serial](#esp-to-serial)
18+
* [Minimal Hardware Setup for Bootloading only](#minimal-hardware-setup-for-bootloading-only)
19+
* [Minimal Hardware Setup for Running only](#minimal-hardware-setup-for-running-only)
20+
* [Minimal](#minimal)
21+
* [Improved Stability](#improved-stability)
22+
* [Boot Messages and Modes](#boot-messages-and-modes)
23+
* [rst cause](#rst-cause)
24+
* [boot mode](#boot-mode)
25+
* [WeMos D1](#wemos-d1)
26+
* [WeMos D1 mini](#wemos-d1-mini)
27+
28+
## Adafruit HUZZAH ESP8266 (ESP-12)
1729

1830
*TODO: add notes*
1931

20-
### NodeMCU 0.9 <a name="nodemcu-0-9"></a>
32+
## NodeMCU 0.9
2133

22-
#### Pin mapping
34+
### Pin mapping
2335

2436
Pin numbers written on the board itself do not correspond to ESP8266 GPIO pin numbers. Constants are defined to make using this board easier:
2537

@@ -39,7 +51,7 @@ static const uint8_t D10 = 1;
3951

4052
If you want to use NodeMCU pin 5, use D5 for pin number, and it will be translated to 'real' GPIO pin 14.
4153

42-
### NodeMCU 1.0
54+
## NodeMCU 1.0
4355

4456
This module is sold under many names for around $6.50 on AliExpress and it's one of the cheapest, fully integrated ESP8266 solutions.
4557

@@ -51,7 +63,7 @@ The board also features a NCP1117 voltage regulator, a blue LED on GPIO16 and a
5163

5264
Full pinout and PDF schematics can be found [here](https://github.com/nodemcu/nodemcu-devkit-v1.0)
5365

54-
### Olimex MOD-WIFI-ESP8266-DEV
66+
## Olimex MOD-WIFI-ESP8266-DEV
5567

5668
This board comes with 2 MB of SPI flash and optional accessories (e.g. evaluation board ESP8266-EVB or BAT-BOX for batteries).
5769

@@ -65,21 +77,21 @@ UART pins for programming and serial I/O are GPIO1 (TXD, pin 3) and GPIO3 (RXD,
6577

6678
Get the board schematics [here](https://github.com/OLIMEX/ESP8266/blob/master/HARDWARE/MOD-WIFI-ESP8266-DEV/MOD-WIFI-ESP8266-DEV_schematic.pdf)
6779

68-
### Olimex MOD-WIFI-ESP8266
80+
## Olimex MOD-WIFI-ESP8266
6981

7082
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.
7183

72-
### SparkFun ESP8266 Thing ###
84+
## SparkFun ESP8266 Thing ###
7385

7486
Product page: https://www.sparkfun.com/products/13231
7587

7688
*TODO: add notes*
7789

78-
### SweetPea ESP-210
90+
## SweetPea ESP-210
7991

8092
*TODO: add notes*
8193

82-
### Generic ESP8266 modules
94+
## Generic ESP8266 modules
8395

8496
These modules come in different form factors and pinouts. See the page at ESP8266 community wiki for more info:
8597
[ESP8266 Module Family](http://www.esp8266.com/wiki/doku.php?id=esp8266-module-family).
@@ -94,10 +106,10 @@ In order to use these modules, make sure to observe the following:
94106

95107
- **Put ESP8266 into bootloader mode** before uploading code.
96108

97-
### Serial Adapter
109+
## Serial Adapter
98110

99111
There are many different USB to Serial adapters / boards.
100-
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.
112+
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.
101113

102114
Adapters based around the following ICs should work:
103115

@@ -107,7 +119,7 @@ Adapters based around the following ICs should work:
107119

108120
PL2303-based adapters are known not to work on Mac OS X. See https://github.com/igrr/esptool-ck/issues/9 for more info.
109121

110-
### Minimal Hardware Setup for Bootloading and Usage
122+
## Minimal Hardware Setup for Bootloading and Usage
111123

112124

113125
| PIN | Resistor | Serial Adapter |
@@ -127,10 +139,10 @@ PL2303-based adapters are known not to work on Mac OS X. See https://github.com/
127139
- GPIO2 is alternative TX for the boot loader mode
128140
- **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.**
129141

130-
### ESP to Serial
142+
## ESP to Serial
131143
![ESP to Serial](ESP_to_serial.png)
132144

133-
#### Minimal Hardware Setup for Bootloading only ##
145+
### Minimal Hardware Setup for Bootloading only ##
134146
ESPxx Hardware
135147

136148
| PIN | Resistor | Serial Adapter |
@@ -147,7 +159,7 @@ ESPxx Hardware
147159
* Note
148160
- if no RTS is used a manual power toggle is needed
149161

150-
#### Minimal Hardware Setup for Running only ##
162+
### Minimal Hardware Setup for Running only ##
151163

152164
ESPxx Hardware
153165

@@ -159,13 +171,13 @@ ESPxx Hardware
159171
| GPIO15 | PullDown | |
160172
| CH_PD | PullUp | |
161173

162-
### Minimal
174+
## Minimal
163175
![ESP min](ESP_min.png)
164176

165-
### Improved Stability
177+
## Improved Stability
166178
![ESP improved stability](ESP_improved_stability.png)
167179

168-
### Boot Messages and Modes
180+
## Boot Messages and Modes
169181

170182
The ESP module checks at every boot the Pins 0, 2 and 15.
171183
based on them its boots in different modes:
@@ -182,21 +194,21 @@ at startup the ESP prints out the current boot mode example:
182194
rst cause:2, boot mode:(3,6)
183195
```
184196

185-
note:
197+
note:
186198
- GPIO2 is used as TX output and the internal Pullup is enabled on boot.
187199

188-
#### rst cause
200+
### rst cause
189201

190202
| Number | Description |
191203
| ------ | ---------------------- |
192204
| 0 | unknown |
193205
| 1 | normal boot |
194206
| 2 | reset pin |
195207
| 3 | software reset |
196-
| 4 | watchdog reset |
208+
| 4 | watchdog reset |
197209

198210

199-
#### boot mode
211+
### boot mode
200212

201213
the first value respects the pin setup of the Pins 0, 2 and 15.
202214

@@ -214,7 +226,8 @@ the first value respects the pin setup of the Pins 0, 2 and 15.
214226
note:
215227
- number = ((GPIO15 << 2) | (GPIO0 << 1) | GPIO2);
216228

217-
### WeMos D1
229+
## WeMos D1
218230
Product page: http://wemos.cc
219-
### WeMos D1 mini
231+
232+
## WeMos D1 mini
220233
Product page: http://wemos.cc

β€Ždoc/changes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Change log
2+
title: Change Log
33
---
44

55
*Current release*

β€Ždoc/filesystem.md

+253
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
---
2+
title: File System
3+
---
4+
5+
## Table of Contents
6+
* [Flash layout](#flash-layout)
7+
* [Uploading files to file system](#uploading-files-to-file-system)
8+
* [File system object (SPIFFS)](#file-system-object-spiffs)
9+
* [begin](#begin)
10+
* [format](#format)
11+
* [open](#open)
12+
* [exists](#exists)
13+
* [openDir](#opendir)
14+
* [remove](#remove)
15+
* [rename](#rename)
16+
* [info](#info)
17+
* [Filesystem information structure](#filesystem-information-structure)
18+
* [Directory object (Dir)](#directory-object-dir)
19+
* [File object](#file-object)
20+
* [seek](#seek)
21+
* [position](#position)
22+
* [size](#size)
23+
* [name](#name)
24+
* [close](#close)
25+
26+
27+
## Flash layout
28+
29+
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.
30+
31+
The following diagram illustrates flash layout used in Arduino environment:
32+
33+
|--------------|-------|---------------|--|--|--|--|--|
34+
^ ^ ^ ^ ^
35+
Sketch OTA update File system EEPROM WiFi config (SDK)
36+
37+
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:
38+
39+
Board | Flash chip size, bytes | File system size, bytes
40+
------|-----------------|-----------------
41+
Generic module | 512k | 64k
42+
Generic module | 1M | 64k, 128k, 256k, 512k
43+
Generic module | 2M | 1M
44+
Generic module | 4M | 3M
45+
Adafruit HUZZAH | 4M | 1M, 3M
46+
NodeMCU 0.9 | 4M | 1M, 3M
47+
NodeMCU 1.0 | 4M | 1M, 3M
48+
Olimex MOD-WIFI-ESP8266(-DEV)| 2M | 1M
49+
SparkFun Thing | 512k | 64k
50+
SweetPea ESP-210 | 4M | 1M, 3M
51+
WeMos D1 & D1 mini | 4M | 1M, 3M
52+
53+
**Note:** to use any of file system functions in the sketch, add the following include to the sketch:
54+
55+
```c++
56+
#include "FS.h"
57+
```
58+
59+
## Uploading files to file system
60+
61+
*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.
62+
63+
- Download the tool: https://github.com/esp8266/arduino-esp8266fs-plugin/releases/download/0.1.3/ESP8266FS-0.1.3.zip.
64+
- In your Arduino sketchbook directory, create `tools` directory if it doesn't exist yet
65+
- Unpack the tool into `tools` directory (the path will look like `<home_dir>/Arduino/tools/ESP8266FS/tool/esp8266fs.jar`)
66+
- Restart Arduino IDE
67+
- Open a sketch (or create a new one and save it)
68+
- Go to sketch directory (choose Sketch > Show Sketch Folder)
69+
- Create a directory named `data` and any files you want in the file system there
70+
- Make sure you have selected a board, port, and closed Serial Monitor
71+
- 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.
72+
73+
74+
## File system object (SPIFFS)
75+
76+
### begin
77+
78+
```c++
79+
SPIFFS.begin()
80+
```
81+
82+
This method mounts SPIFFS file system. It must be called before any other
83+
FS APIs are used. Returns *true* if file system was mounted successfully, false
84+
otherwise.
85+
86+
### format
87+
88+
```c++
89+
SPIFFS.format()
90+
```
91+
92+
Formats the file system. May be called either before or after calling `begin`.
93+
Returns *true* if formatting was successful.
94+
95+
### open
96+
97+
```c++
98+
SPIFFS.open(path, mode)
99+
```
100+
101+
Opens a file. `path` should be an absolute path starting with a slash
102+
(e.g. `/dir/filename.txt`). `mode` is a string specifying access mode. It can be
103+
one of "r", "w", "a", "r+", "w+", "a+". Meaning of these modes is the same as
104+
for `fopen` C function.
105+
106+
Returns *File* object. To check whether the file was opened successfully, use
107+
the boolean operator.
108+
109+
```c++
110+
File f = SPIFFS.open("/f.txt", "w");
111+
if (!f) {
112+
Serial.println("file open failed");
113+
}
114+
```
115+
116+
### exists
117+
118+
```c++
119+
SPIFFS.exists(path)
120+
```
121+
122+
Returns *true* if a file with given path exists, *false* otherwise.
123+
124+
### openDir
125+
126+
```c++
127+
SPIFFS.openDir(path)
128+
```
129+
130+
Opens a directory given its absolute path. Returns a *Dir* object. To check if
131+
directory was opened successfully, use the boolean operator, similar to opening
132+
a file.
133+
134+
### remove
135+
136+
```c++
137+
SPIFFS.remove(path)
138+
```
139+
140+
Deletes the file given its absolute path. Returns *true* if file was deleted successfully.
141+
142+
### rename
143+
144+
```c++
145+
SPIFFS.rename(pathFrom, pathTo)
146+
```
147+
148+
Renames file from `pathFrom` to `pathTo`. Paths must be absolute. Returns *true*
149+
if file was renamed successfully.
150+
151+
### info
152+
153+
```c++
154+
FSInfo fs_info;
155+
SPIFFS.info(fs_info);
156+
```
157+
158+
Fills [FSInfo structure](#filesystem-information-structure) with information about
159+
the file system. Returns `true` is successful, `false` otherwise.
160+
161+
## Filesystem information structure
162+
163+
```c++
164+
struct FSInfo {
165+
size_t totalBytes;
166+
size_t usedBytes;
167+
size_t blockSize;
168+
size_t pageSize;
169+
size_t maxOpenFiles;
170+
size_t maxPathLength;
171+
};
172+
```
173+
174+
This is the structure which may be filled using FS::info method. Field names
175+
are self-explanatory.
176+
177+
## Directory object (Dir)
178+
179+
The purpose of *Dir* object is to iterate over files inside a directory.
180+
It provides three methods: `next()`, `fileName()`, and `openFile(mode)`.
181+
182+
The following example shows how it should be used:
183+
184+
```c++
185+
Dir dir = SPIFFS.openDir("/data");
186+
while (dir.next()) {
187+
Serial.print(dir.fileName());
188+
File f = dir.openFile("r");
189+
Serial.println(f.size());
190+
}
191+
```
192+
193+
`dir.next()` returns true while there are files in the directory to iterate over.
194+
It must be called before calling `fileName` and `openFile` functions.
195+
196+
`openFile` method takes *mode* argument which has the same meaning as for `SPIFFS.open` function.
197+
198+
## File object
199+
200+
`SPIFFS.open` and `dir.openFile` functions return a *File* object. This object
201+
supports all the functions of *Stream*, so you can use `readBytes`, `findUntil`,
202+
`parseInt`, `println`, and all other *Stream* methods.
203+
204+
There are also some functions which are specific to *File* object.
205+
206+
### seek
207+
208+
```c++
209+
file.seek(offset, mode)
210+
```
211+
212+
This function behaves like `fseek` C function. Depending on the value of `mode`,
213+
it moves current position in a file as follows:
214+
215+
- if `mode` is `SeekSet`, position is set to `offset` bytes from the beginning.
216+
- if `mode` is `SeekCur`, current position is moved by `offset` bytes.
217+
- if `mode` is `SeekEnd`, position is set to `offset` bytes from the end of the
218+
file.
219+
220+
Returns *true* if position was set successfully.
221+
222+
### position
223+
224+
```c++
225+
file.position()
226+
```
227+
228+
Returns the current position inside the file, in bytes.
229+
230+
### size
231+
232+
```c++
233+
file.size()
234+
```
235+
236+
Returns file size, in bytes.
237+
238+
239+
### name
240+
241+
```c++
242+
String name = file.name();
243+
```
244+
245+
Returns file name, as `const char*`. Convert it to *String* for storage.
246+
247+
### close
248+
249+
```c++
250+
file.close()
251+
```
252+
253+
Close the file. No other operations should be performed on *File* object after `close` function was called.

β€Ždoc/installing.md

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
title: Installation
3+
---
4+
5+
## Boards Manager ##
6+
7+
This is the suggested installation method for end users.
8+
9+
### Prerequisites
10+
- Arduino 1.6.5, get it from [Arduino website](https://www.arduino.cc/en/Main/OldSoftwareReleases#previous). Arduino 1.6.6 has several issues, so we recommend to stick with 1.6.5 for now.
11+
- Internet connection
12+
13+
### Instructions
14+
- Start Arduino and open Preferences window.
15+
- 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.
16+
- Open Boards Manager from Tools > Board menu and find *esp8266* platform.
17+
- Select the version you need from a drop-down box.
18+
- Click *install* button.
19+
- Don't forget to select your ESP8266 board from Tools > Board menu after installation.
20+
21+
You may optionally use *staging* boards manager package link:
22+
`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.
23+
24+
## Using git version
25+
26+
This is the suggested installation method for contributors and library developers.
27+
28+
### Prerequisites
29+
30+
- Arduino 1.6.5 (or newer, if you know what you are doing)
31+
- git
32+
- python 2.7
33+
- terminal, console, or command prompt (depending on you OS)
34+
- Internet connection
35+
36+
### Instructions
37+
38+
- 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.
39+
- Clone this repository into hardware/esp8266com/esp8266 directory. Alternatively, clone it elsewhere and create a symlink, if your OS supports them.
40+
41+
```bash
42+
cd hardware
43+
mkdir esp8266com
44+
cd esp8266com
45+
git clone https://github.com/esp8266/Arduino.git esp8266
46+
```
47+
You should end up with the following directory structure:
48+
49+
```bash
50+
Arduino
51+
|
52+
--- hardware
53+
|
54+
--- esp8266com
55+
|
56+
--- esp8266
57+
|
58+
--- bootloaders
59+
--- cores
60+
--- doc
61+
--- libraries
62+
--- package
63+
--- tests
64+
--- tools
65+
--- variants
66+
--- platform.txt
67+
--- programmers.txt
68+
--- README.md
69+
--- boards.txt
70+
--- LICENSE
71+
```
72+
73+
- Download binary tools
74+
75+
```bash
76+
cd esp8266/tools
77+
python get.py
78+
```
79+
80+
- Restart Arduino

β€Ždoc/libraries.md

+153
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
---
2+
title: Libraries
3+
---
4+
5+
## Table of Contents
6+
* [WiFi(ESP8266WiFi library)](#wifiesp8266wifi-library)
7+
* [Ticker](#ticker)
8+
* [EEPROM](#eeprom)
9+
* [I2C (Wire library)](#i2c-wire-library)
10+
* [SPI](#spi)
11+
* [SoftwareSerial](#softwareserial)
12+
* [ESP\-specific APIs](#esp-specific-apis)
13+
* [OneWire](#onewire)
14+
* [mDNS and DNS\-SD responder (ESP8266mDNS library)](#mdns-and-dns-sd-responder-esp8266mdns-library)
15+
* [SSDP responder (ESP8266SSDP)](#ssdp-responder-esp8266ssdp)
16+
* [DNS server (DNSServer library)](#dns-server-dnsserver-library)
17+
* [Servo](#servo)
18+
* [Other libraries (not included with the IDE)](#other-libraries-not-included-with-the-ide)
19+
20+
## WiFi(ESP8266WiFi library)
21+
22+
This is mostly similar to WiFi shield library. Differences include:
23+
24+
- `WiFi.mode(m)`: set mode to `WIFI_AP`, `WIFI_STA`, `WIFI_AP_STA` or `WIFI_OFF`.
25+
- call `WiFi.softAP(ssid)` to set up an open network
26+
- call `WiFi.softAP(ssid, password)` to set up a WPA2-PSK network (password should be at least 8 characters)
27+
- `WiFi.macAddress(mac)` is for STA, `WiFi.softAPmacAddress(mac)` is for AP.
28+
- `WiFi.localIP()` is for STA, `WiFi.softAPIP()` is for AP.
29+
- `WiFi.printDiag(Serial)` will print out some diagnostic info
30+
- `WiFiUDP` class supports sending and receiving multicast packets on STA interface.
31+
When sending a multicast packet, replace `udp.beginPacket(addr, port)` with
32+
`udp.beginPacketMulticast(addr, port, WiFi.localIP())`.
33+
When listening to multicast packets, replace `udp.begin(port)` with
34+
`udp.beginMulticast(WiFi.localIP(), multicast_ip_addr, port)`.
35+
You can use `udp.destinationIP()` to tell whether the packet received was
36+
sent to the multicast or unicast address.
37+
38+
`WiFiServer`, `WiFiClient`, and `WiFiUDP` behave mostly the same way as with WiFi shield library.
39+
Four samples are provided for this library.
40+
You can see more commands here: [http://www.arduino.cc/en/Reference/WiFi](http://www.arduino.cc/en/Reference/WiFi)
41+
42+
## Ticker
43+
44+
Library for calling functions repeatedly with a certain period. Two examples included.
45+
46+
It is currently not recommended to do blocking IO operations (network, serial, file) from Ticker
47+
callback functions. Instead, set a flag inside the ticker callback and check for that flag inside the loop function.
48+
49+
## EEPROM
50+
51+
This is a bit different from standard EEPROM class. You need to call `EEPROM.begin(size)`
52+
before you start reading or writing, size being the number of bytes you want to use.
53+
Size can be anywhere between 4 and 4096 bytes.
54+
55+
`EEPROM.write` does not write to flash immediately, instead you must call `EEPROM.commit()`
56+
whenever you wish to save changes to flash. `EEPROM.end()` will also commit, and will
57+
release the RAM copy of EEPROM contents.
58+
59+
EEPROM library uses one sector of flash located just after the SPIFFS.
60+
61+
Three examples included.
62+
63+
## I2C (Wire library)
64+
65+
Wire library currently supports master mode up to approximately 450KHz.
66+
Before using I2C, pins for SDA and SCL need to be set by calling
67+
`Wire.begin(int sda, int scl)`, i.e. `Wire.begin(0, 2)` on ESP-01,
68+
else they default to pins 4(SDA) and 5(SCL).
69+
70+
## SPI
71+
72+
SPI library supports the entire Arduino SPI API including transactions, including setting phase (CPHA).
73+
Setting the Clock polarity (CPOL) is not supported, yet (SPI_MODE2 and SPI_MODE3 not working).
74+
75+
## SoftwareSerial
76+
77+
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.
78+
79+
## ESP-specific APIs
80+
81+
APIs related to deep sleep and watchdog timer are available in the `ESP` object, only available in Alpha version.
82+
83+
`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.)
84+
85+
`ESP.restart()` restarts the CPU.
86+
87+
`ESP.getFreeHeap()` returns the free heap size.
88+
89+
`ESP.getChipId()` returns the ESP8266 chip ID as a 32-bit integer.
90+
91+
Several APIs may be used to get flash chip info:
92+
93+
`ESP.getFlashChipId()` returns the flash chip ID as a 32-bit integer.
94+
95+
`ESP.getFlashChipSize()` returns the flash chip size, in bytes, as seen by the SDK (may be less than actual size).
96+
97+
`ESP.getFlashChipSpeed(void)` returns the flash chip frequency, in Hz.
98+
99+
`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.
100+
101+
`ESP.getVcc()` may be used to measure supply voltage. ESP needs to reconfigure the ADC
102+
at startup in order for this feature to be available. Add the following line to the top
103+
of your sketch to use `getVcc`:
104+
105+
```c++
106+
ADC_MODE(ADC_VCC);
107+
```
108+
109+
TOUT pin has to be disconnected in this mode.
110+
111+
Note that by default ADC is configured to read from TOUT pin using `analogRead(A0)`, and
112+
`ESP.getVCC()` is not available.
113+
114+
## OneWire
115+
116+
Library was adapted to work with ESP8266 by including register definitions into OneWire.h
117+
Note that if you already have OneWire library in your Arduino/libraries folder, it will be used
118+
instead of the one that comes with this package.
119+
120+
## mDNS and DNS-SD responder (ESP8266mDNS library)
121+
122+
Allows the sketch to respond to multicast DNS queries for domain names like "foo.local", and DNS-SD (service dicovery) queries.
123+
See attached example for details.
124+
125+
## SSDP responder (ESP8266SSDP)
126+
127+
SSDP is another service discovery protocol, supported on Windows out of the box. See attached example for reference.
128+
129+
## DNS server (DNSServer library)
130+
131+
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.
132+
See attached example for details.
133+
134+
## Servo
135+
136+
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.
137+
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.
138+
139+
## Other libraries (not included with the IDE)
140+
141+
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:
142+
143+
- [arduinoWebSockets](https://github.com/Links2004/arduinoWebSockets) - WebSocket Server and Client compatible with ESP8266 (RFC6455)
144+
- [aREST](https://github.com/marcoschwartz/aREST) REST API handler library.
145+
- [Blynk](https://github.com/blynkkk/blynk-library) - easy IoT framework for Makers (check out the [Kickstarter page](http://tiny.cc/blynk-kick)).
146+
- [DallasTemperature](https://github.com/milesburton/Arduino-Temperature-Control-Library.git)
147+
- [DHT-sensor-library](https://github.com/adafruit/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)`
148+
- [NeoPixel](https://github.com/adafruit/Adafruit_NeoPixel) - Adafruit's NeoPixel library, now with support for the ESP8266 (use version 1.0.2 or higher from Arduino's library manager).
149+
- [NeoPixelBus](https://github.com/Makuna/NeoPixelBus) - Arduino NeoPixel library compatible with ESP8266. Use the "NeoPixelAnimator" branch for ESP8266 to get HSL color support and more.
150+
- [PubSubClient](https://github.com/Imroy/pubsubclient) MQTT library by @Imroy.
151+
- [RTC](https://github.com/Makuna/Rtc) - Arduino Library for Ds1307 & Ds3231 compatible with ESP8266.
152+
- [Souliss, Smart Home](https://github.com/souliss/souliss) - Framework for Smart Home based on Arduino, Android and openHAB.
153+
- [ST7735](https://github.com/nzmichaelh/Adafruit-ST7735-Library) - 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.

β€Ždoc/ota_updates/ota_updates.md

+77-77
Large diffs are not rendered by default.

β€Ždoc/reference.md

+7-401
Large diffs are not rendered by default.

β€Ždoc/reference_items.yml

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# This file defines the order in which documents will appear in the menu
2+
3+
- path: /doc/installing.html
4+
5+
- path: /doc/reference.html
6+
7+
- path: /doc/libraries.html
8+
9+
- path: /doc/filesystem.html
10+
11+
- path: /doc/ota_updates/ota_updates.html
12+
13+
- path: /doc/boards.html
14+
15+
- path: /doc/changes.html

β€Žpackage/esp8266-arudino-doc.bash

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/usr/bin/env bash
22

33
#
44
# @file esp8266-arudino-doc.bash
@@ -11,15 +11,16 @@
1111
# Packages needed by this script:
1212
# * linux commands: ln, cp, mkdir, rm, wget
1313
# * git
14-
# * jekyll
1514
#
16-
# ruby libraries:
15+
# ruby gems:
16+
# * jekyll
1717
# * redcarpet
1818
# * rb-pygments
1919
#
2020
# gem install [lib]
2121
#
2222

23+
set -e
2324

2425
# some variable definitions
2526
tmp_path=$1
@@ -37,11 +38,11 @@ echo " version: "$version
3738
echo " release date: "$release_date
3839
echo " build date: "$build_date
3940
echo " put documentation into: "$destination_path
40-
echo "documentatino template url: "$doc_template_url
41+
echo "documentation template url: "$doc_template_url
4142
echo " url: "$url
4243

4344
# continue?
44-
read -e -p "Dou you wish to continue (y/n)? " -n 1 -i "y" decision
45+
read -e -p "Dou you wish to continue (y/n)? " -n 1 decision
4546
if echo "$decision" | grep -iq "^y" ;then
4647
echo "okay"
4748
else
@@ -99,8 +100,10 @@ ln -s ../$version _site
99100

100101
# add subtitle and basurl
101102
echo "url: \"$url\"" > _config_local.yml
102-
echo "subtitle: \"ver. $version, built on $build_date\"" >> _config_local.yml
103+
echo "version: $version" >> _config_local.yml
104+
echo "build_date: $build_date" >> _config_local.yml
103105
echo "baseurl: /Arduino/versions/$version" >> _config_local.yml
106+
mv doc/reference_items.yml _data/reference_items.yml
104107

105108
# build with jekyll
106109
jekyll build --config _config.yml,_config_local.yml

4 commit comments

Comments
 (4)

igrr commented on Nov 25, 2015

@igrr
MemberAuthor

Sorry guys, it seems that it's quite hard to write markdown which will give the same result in two different markdown parsers :(
I was "fixing" this to make output look correctly in web version (http://esp8266.github.io/Arduino/versions/2.0.0-rc2/), apparently need to make a few iterations to find the right amount of spacing so both versions look the same.

krzychb commented on Nov 25, 2015

@krzychb
Contributor

@igrr,

Frankly saying I was not aware that three is a separate version of documentation attached to each release until I checked this commit.

Did you consider using only one type of documentation for s/w releases and for github repository?

I am not sure what it takes to maintain two versions but I believe they will never be the same πŸ˜„

I would appeal that instead of bothering how to fix it, drop one of them and allocate your time to strategic development of this cool s/w πŸ‘

Web version looks nicer to me than md. Is it possible to drop all md files except readme.md and provide a link under https://github.com/esp8266/Arduino/wiki to the latest html documentation?

Krzysztof

igrr commented on Nov 25, 2015

@igrr
MemberAuthor

igrr commented on Nov 30, 2015

@igrr
MemberAuthor

Fixed tables of contents and images, please let me know if i missed anything.

Turns out, GFM needs an empty line before an image, while kmarkdown doesn't. Just something to remember when writing future docs.

Please sign in to comment.