1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-08-09 22:24:14 +03:00
Files
esp8266/NOTES
Ivan Grokhotkov 04aa4804e0 Update build notes
2014-12-23 12:50:56 +03:00

93 lines
3.6 KiB
Plaintext

Arduino IDE with ESP8266 support
================================
This is an early beta. Things might not work as expected, please do report any bugs you find.
What works
----------
- pinMode, digitalRead, digitalWrite
Pin numbers correspond directly to the esp8266 GPIO pin numbers. To read GPIO2,
call digitalRead(2);
- analogRead(0) reads the value of the ADC channel connected to the TOUT pin.
- pin interrupts (attachInterrupt, detachInterrupt)
Interrupts may be attach to any GPIO pin. Standard Arduino interrupt types are
supported: CHANGE, RISING, FALLING.
- shiftIn, shiftOut
- millis, micros
- delay, delayMicroseconds, yield
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.
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
Only 8n1 is supported right now. By default the diagnostic output from WiFi
libraries is disabled when you call Serial.begin. To enable debug output again,
call Serial.setDebugOutput(true);
- Ticker
Library for calling functions repeatedly with a certain period. Two examples included.
- 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.
Three examples included.
- I2C (Wire library)
Only master mode works, and I haven't tested if Wire.setClock gives correct frequency.
Before using I2C, you need to set pins you will use for SDA and SCL by calling
Wire.pins(int sda, int scl), i.e. Wire.pins(0, 2); on ESP-01.
- WiFi (ESP8266WiFi library)
This is mostly similar to WiFi shield library. Differences include:
* WiFi.mode(m): set mode to WIFI_AP, WIFI_STA, or WIFI_AP_STA.
* call WiFi.softAP(ssid) to set up an open network
* call WiFi.softAP(ssid, passphrase) to set up a WPA2-PSK network
* WiFi.macAddress(mac) is for STA, WiFi.softAPmacAddress(mac) is for AP.
* WiFi.localIP() is for STA, WiFi.softAPIP() is for AP.
* WiFi.RSSI() doesn't work
* WiFi.printDiag(Serial); will print out some diagnostic info
WiFiServer and WiFiClient behave mostly the same way as with WiFi shield library.
- Other libraries that don't rely on low-level access to AVR registers.
- Upload via serial port
Select "esptool" as a programmer, and pick the correct serial port.
You need to put ESP8266 into bootloader mode before uploading code (pull GPIO0 low and toggle power).
What is not done yet
--------------------
- analogWrite (PWM)
- pulseIn
- SPI
- UDP
- I2C slave mode
- Serial modes other than 8n1
- WiFi.RSSI
- Upload sketches via WiFi
- Samples for all the libraries
License and credits
-------------------
Arduino is licensed under GPL, with Arduino core libraries licensed under LGPL.
This build includes an xtensa gcc toolchain, which is also under GPL.
Espressif SDK included in this build is under Espressif Public License.
ESP8266 port contributed by Ivan Grokhotkov, igrokhotkov at gmail dot com.
If you want to use some code in cores/esp8266 directory under a different license
for your project, drop me a line.