Additionally, the following line has to be added to the sketch: To read VCC voltage, ADC pin must be kept unconnected. To read external voltage applied to ADC pin, use analogRead(A0). It may be used either to read voltage at ADC pin, or to read module supply voltage (VCC). Analog inputĮSP8266 has a single ADC channel available to users. Types are supported: CHANGE, RISING, FALLING. Interrupts may be attached to any GPIO pin, except GPIO16. Pin interrupts are supported through attachInterrupt, detachInterrupt functions. These may be used as IO if flash chip works in DIO mode (as opposed to QIO, which is the default one). Note that some boards and modules (ESP-12ED, NodeMCU 1.0) also break out pins 9 and 11. Trying to use these pins as IOs will likely cause the program to crash. The diagram below shows pin mapping for the popular ESP-12 module.ĭigital pins 6-11 are not shown on this diagram because they are used to connect flash memory chip on most modules. These functions are normally activated by the corresponding library. Pins may also serve other functions, like Serial, I2C, SPI. At startup, pins are configured as INPUT. Pin 16 can be INPUT, OUTPUT or INPUT_PULLDOWN_16. pinMode, digitalRead, and digitalWrite functions work as usual, so to read GPIO2, call digitalRead(2).ĭigital pins 0-15 can be INPUT, OUTPUT, or INPUT_PULLUP. Pin numbers in Arduino correspond directly to the ESP8266 GPIO pin numbers.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |