Thursday, December 31, 2015

Standalone ESP8266/ESP-12, read GPIO with pull-up resistor.

This example set GPIO12 as input with pull-up resistor. Turn ON/OFF on-board LED according to GPIO12 input.

 ESP8266 Read input from GPIO12, write to on-board LED

int pin_Button = 12;  //GPIO12 

void setup() {

  pinMode(pin_Button, INPUT_PULLUP);

void loop() {

    digitalWrite(BUILTIN_LED, LOW);   //LED ON
    digitalWrite(BUILTIN_LED, HIGH);  //LED OFF


1 comment:

  1. Hi
    Is there some code using Arduino IDE to read and get the status of any pin on the V1 ESP8266? for example:
    if ( (2) == 0) then
    or something similar that works in arduino IDE