Skip to content

Commit 2db45e7

Browse files
committed
Update readme
[ci skip]
1 parent f008806 commit 2db45e7

File tree

1 file changed

+35
-18
lines changed

1 file changed

+35
-18
lines changed

README.md

+35-18
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,18 @@ $ ant dist
2727

2828
#### Basic Wiring functions ####
2929

30-
```pinMode```, ```digitalRead```, ```digitalWrite``` work as usual.
30+
```pinMode```, ```digitalRead```, ```digitalWrite```, ```analogWrite``` work as usual.
3131

3232
Pin numbers correspond directly to the esp8266 GPIO pin numbers. To read GPIO2,
3333
call ```digitalRead(2);```
3434

3535
GPIO0-GPIO15 can be ```INPUT```, ```OUTPUT```, ```INPUT_PULLUP```, and ```OUTPUT_OPEN_DRAIN```.
3636
GPIO16 can be ```INPUT``` or ```OUTPUT```.
3737

38-
```analogRead(0)``` reads the value of the ADC channel connected to the TOUT pin.
38+
```analogRead(A0)``` reads the value of the ADC channel connected to the TOUT pin.
39+
40+
```analogWrite(pin, value)``` enables software PWM on the given pin. PWM may be used on pins 0 to 15.
41+
Call ```analogWrite(pin, 0)``` to disable PWM on the pin.
3942

4043
Pin interrupts are supported through ```attachInterrupt```, ```detachInterrupt``` functions.
4144
Interrupts may be attached to any GPIO pin, except GPIO16. Standard Arduino interrupt
@@ -62,7 +65,13 @@ more than 20 milliseconds is not recommended.
6265

6366
```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.
6467

65-
By default the diagnostic output from WiFi libraries is disabled when you call ```Serial.begin```. To enable debug output again, call ```Serial.setDebugOutput(true);```
68+
```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.
69+
70+
```Serial1``` uses UART1 which is a transmit-only UART. UART1 TX pin is GPIO2. To use ```Serial1```, call ```Serial1.begin```.
71+
72+
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);```.
73+
74+
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.
6675

6776
#### WiFi(ESP8266WiFi library) ####
6877

@@ -91,6 +100,9 @@ Four samples are provided for this library.
91100

92101
Library for calling functions repeatedly with a certain period. Two examples included.
93102

103+
It is currently not recommended to do blocking IO operations (network, serial, file) from Ticker
104+
callback functions. Instead, set a flag inside the ticker callback and check for that flag inside the loop function.
105+
94106
#### EEPROM ####
95107

96108
This is a bit different from standard EEPROM class. You need to call ```EEPROM.begin(size)```
@@ -101,29 +113,43 @@ Size can be anywhere between 4 and 4096 bytes.
101113
whenever you wish to save changes to flash. ```EEPROM.end()``` will also commit, and will
102114
release the RAM copy of EEPROM contents.
103115

116+
EEPROM library uses one sector of flash located at 0x7b000 for storage.
117+
104118
Three examples included.
105119

106120
#### I2C (Wire library) ####
107121

108-
Only master mode works, and ```Wire.setClock``` has not been verified to give exactly correct frequency.
122+
Wire library currently supports master mode up to approximately 450KHz (at 80 MHz CPU clock).
109123
Before using I2C, pins for SDA and SCL need to be set by calling
110-
```Wire.pins(int sda, int scl)```, i.e. ```Wire.pins(0, 2);``` on ESP-01.
124+
```Wire.begin(int sda, int scl)```, i.e. ```Wire.begin(0, 2);``` on ESP-01.
111125

112126
#### SPI ####
113127

114-
An initial SPI support for the HSPI interface (GPIO12-15) was implemented by [Sermus](https://github.com/Sermus).
115-
The implementation supports the entire Arduino SPI API including transactions, except setting phase and polarity as it's unclear how to set them in ESP8266 yet.
128+
SPI library supports the entire Arduino SPI API including transactions, including setting phase and polarity.
116129

117130
#### ESP-specific APIs ####
118131

119132
APIs related to deep sleep and watchdog timer are available in the ```ESP``` object.
120133

121-
```ESP.deepSleep(microseconds, mode)``` will put the chip into deep sleep. ```mode``` is one of ```WAKE_DEFAULT```, ```WAKE_RFCAL```, ```WAKE_NO_RFCAL```, ```WAKE_RF_DISABLED```. (GPIO16 needs to be tied to RST to wake from deepSleep.)
134+
```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.)
122135

123136
```ESP.wdtEnable()```, ```ESP.wdtDisable()```, and ```ESP.wdtFeed()``` provide some control over the watchdog timer.
124137

125138
```ESP.reset()``` resets the CPU.
126139

140+
```ESP.getFreeHeap()``` returns the free heap size.
141+
142+
```ESP.getChipId()``` returns the ESP8266 chip ID as a 32-bit integer.
143+
144+
Several APIs may be used to get flash chip info:
145+
146+
```ESP.getFlashChipId()``` returns the flash chip ID as a 32-bit integer.
147+
148+
```ESP.getFlashChipSize()``` returns the flash chip size, in bytes, as seen by the SDK (may be less than actual size).
149+
150+
```ESP.getFlashChipSpeed(void)``` returns the flash chip frequency, in Hz.
151+
152+
127153
#### OneWire (from https://www.pjrc.com/teensy/td_libs_OneWire.html) ####
128154

129155
Library was adapted to work with ESP8266 by including register definitions into OneWire.h
@@ -133,6 +159,7 @@ instead of the one that comes with the Arduino IDE (this one).
133159
#### mDNS responder (ESP8266mDNS library) ####
134160

135161
Allows the sketch to respond to multicast DNS queries for domain names like "foo.local".
162+
Currently the library only works on STA interface, AP interface is not supported.
136163
See attached example and library README file for details.
137164

138165
#### Other libraries (not included with the IDE)
@@ -150,16 +177,6 @@ Pick the correct serial port.
150177
You need to put ESP8266 into bootloader mode before uploading code (pull GPIO0 low and
151178
toggle power).
152179

153-
### Things not done yet ###
154-
155-
- analogWrite (PWM). ESP8266 has only one hardware PWM source. It is not yet clear how to use it with analogWrite API. Software PWM is also an option, but apparently it causes issues with WiFi connectivity.
156-
- pulseIn
157-
- I2C slave mode
158-
- WiFi.RSSI. SDK doesn't seem to have an API to get RSSI for the current network. So far the only
159-
way to obtain RSSI is to disconnect, perform a scan, and get the RSSI value from there.
160-
- Upload sketches via WiFi. Conceptually and technically simple, but need to figure out how to provide the best UX for this feature.
161-
- Samples for all the libraries
162-
163180
### Issues and support ###
164181

165182
Forum: http://www.esp8266.com/arduino

0 commit comments

Comments
 (0)