You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+14-14Lines changed: 14 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,7 @@ $ ant dist
33
33
34
34
#### Basic Wiring functions ####
35
35
36
-
```pinMode```, ```digitalRead```, ```digitalWrite```, ```analogWrite``` work as usual.
36
+
```pinMode()```, ```digitalRead()```, ```digitalWrite()```, ```analogWrite()``` work as usual.
37
37
38
38
Pin numbers correspond directly to the esp8266 GPIO pin numbers. To read GPIO2,
39
39
call ```digitalRead(2)```
@@ -46,7 +46,7 @@ GPIO16 can be ```INPUT```, ```OUTPUT``` or ```INPUT_PULLDOWN```.
46
46
```analogWrite(pin, value)``` enables software PWM on the given pin. PWM may be used on pins 0 to 15.
47
47
Call ```analogWrite(pin, 0)``` to disable PWM on the pin. ```value``` may be in range from 0 to ```PWMRANGE```, which is currently equal to 1023.
48
48
49
-
Pin interrupts are supported through ```attachInterrupt```, ```detachInterrupt``` functions.
49
+
Pin interrupts are supported through ```attachInterrupt()``` and ```detachInterrupt()``` functions.
50
50
Interrupts may be attached to any GPIO pin, except GPIO16. Standard Arduino interrupt
51
51
types are supported: ```CHANGE```, ```RISING```, ```FALLING```.
52
52
@@ -57,31 +57,31 @@ The most usable pin functions are mapped to the macro ```SPECIAL```, so calling
57
57
will switch that pin in the most usable FUNCTION_X. Those are UART RX/TX on pins 1 - 3, HSPI for pins 12-15 and CLK functions for pins 0, 4 and 5.
58
58
59
59
#### Timing and delays ####
60
-
```millis``` and ```micros``` return the number of milliseconds and microseconds elapsed after reset, respectively.
60
+
```millis()``` and ```micros()``` return the number of milliseconds and microseconds elapsed after reset, respectively.
61
61
62
-
```delay``` pauses the sketch for a given number of milliseconds and allows WiFi and TCP/IP tasks to run.
63
-
```delayMicroseconds``` pauses for a given number of microseconds.
62
+
```delay()``` pauses the sketch for a given number of milliseconds and allows WiFi and TCP/IP tasks to run.
63
+
```delayMicroseconds()``` pauses for a given number of microseconds.
64
64
65
65
Remember that there is a lot of code that needs to run on the chip besides the sketch
66
66
when WiFi is connected. WiFi and TCP/IP libraries get a chance to handle any pending
67
-
events each time the ```loop()``` function completes, OR when ```delay(...)``` is called.
67
+
events each time the ```loop()``` function completes, OR when ```delay()``` is called.
68
68
If you have a loop somewhere in your sketch that takes a lot of time (>50ms) without
69
69
calling ```delay()```, you might consider adding a call to delay function to keep the WiFi
70
70
stack running smoothly.
71
71
72
-
There is also a ```yield()``` function which is equivalent to ```delay(0)```. The delayMicroseconds
72
+
There is also a ```yield()``` function which is equivalent to ```delay(0)```. The ```delayMicroseconds()```
73
73
function, on the other hand, does not yield to other tasks, so using it for delays
74
74
more than 20 milliseconds is not recommended.
75
75
76
76
#### Serial ####
77
77
78
78
```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.
79
79
80
-
```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.
80
+
```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 ```Serial.swap()``` again maps UART0 back to GPIO1 and GPIO3.
81
81
82
-
```Serial1``` uses UART1 which is a transmit-only UART. UART1 TX pin is GPIO2. To use ```Serial1```, call ```Serial1.begin```.
82
+
```Serial1``` uses UART1 which is a transmit-only UART. UART1 TX pin is GPIO2. To use ```Serial1```, call ```Serial1.begin()```.
83
83
84
-
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)```.
84
+
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)```.
85
85
86
86
You also need to use ```Serial.setDebugOutput(true)``` to enable output from the Arduino ```printf()``` function.
87
87
@@ -129,7 +129,7 @@ This is a bit different from standard EEPROM class. You need to call ```EEPROM.b
129
129
before you start reading or writing, size being the number of bytes you want to use.
130
130
Size can be anywhere between 4 and 4096 bytes.
131
131
132
-
```EEPROM.write``` does not write to flash immediately, instead you must call ```EEPROM.commit()```
132
+
```EEPROM.write()``` does not write to flash immediately, instead you must call ```EEPROM.commit()```
133
133
whenever you wish to save changes to flash. ```EEPROM.end()``` will also commit, and will
134
134
release the RAM copy of EEPROM contents.
135
135
@@ -153,7 +153,7 @@ Setting the Clock polarity (CPOL) is not supported, yet (SPI_MODE2 and SPI_MODE3
153
153
154
154
APIs related to deep sleep and watchdog timer are available in the ```ESP``` object, only available in Alpha version.
155
155
156
-
```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.)
156
+
```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 ```ESP.deepSleep()```.)
157
157
158
158
```ESP.restart()``` restarts the CPU.
159
159
@@ -173,14 +173,14 @@ Several APIs may be used to get flash chip info:
173
173
174
174
```ESP.getVcc()``` may be used to measure supply voltage. ESP needs to reconfigure the ADC
175
175
at startup in order for this feature to be available. Add the following line to the top
176
-
of your sketch to use ```getVcc```:
176
+
of your sketch to use ```ESP.getVcc()```:
177
177
```
178
178
ADC_MODE(ADC_VCC);
179
179
```
180
180
TOUT pin has to be disconnected in this mode.
181
181
182
182
Note that by default ADC is configured to read from TOUT pin using ```analogRead(A0)```, and
0 commit comments