// Which pins are able to be used with an internal
// pull up resistor on the Adafruit Feather Huzzah ESP8266?
// There has been some confusion around.
// https://forums.adafruit.com/viewtopic.php?f=19&t=86182
// http://www.esp8266.com/viewtopic.php?f=32&t=11614
// so this is a table of the test
// | GPIO pin | is able to pull up? |
// | :-- | :-- |
// | #0 | No |
// | #2 | Yes |
// | #4 | Yes |
// | #5 | Yes |
// | #12 | Yes |
// | #13 | Yes |
// | #14 | Yes |
// | #15 | No |
// | #16 | No |
int buttonpin = 15;
int ledpin = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(buttonpin, INPUT_PULLUP);
pinMode(ledpin, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println(digitalRead(buttonpin));
if (digitalRead(buttonpin) == LOW) {
digitalWrite(ledpin, HIGH);
} else {
digitalWrite(ledpin, LOW);
}
}