Skip to content

Instantly share code, notes, and snippets.

@leighleighleigh
Created September 20, 2018 06:46
Show Gist options
  • Save leighleighleigh/5445b830058de915d81efb77afbda193 to your computer and use it in GitHub Desktop.
Save leighleighleigh/5445b830058de915d81efb77afbda193 to your computer and use it in GitHub Desktop.
An example of using a GPIO input register to read pin inputs on NodeMCU (esp8266 based) board.
// Our super ultra fast input register
#define GPIO_IN READ_PERI_REG(0x60000318)
#define CHAN0 D1
#define CHAN1 D2
#define CHAN2 D3
#define CHAN3 D4
#define CHAN4 D5
void setup()
{
Serial.begin(115200);
pinMode(D1, INPUT_PULLUP);
pinMode(D2, INPUT_PULLUP);
pinMode(D3, INPUT_PULLUP);
pinMode(D4, INPUT_PULLUP);
pinMode(D5, INPUT_PULLUP);
}
void loop()
{
delay(1000);
uint16_t pins = GPIO_IN;
Serial.println(pins, BIN);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment