|Anna Wiggins 42a3835b43||1 month ago|
|.gitignore||1 month ago|
|Makefile||1 month ago|
|config.h.example||1 month ago|
|gpio-webhook-arduino.ino||1 month ago|
|readme.md||1 month ago|
|wifi.h||1 month ago|
This is an Arduino IDE sketch for a "smart" controller that can activate pins based on the state of some webpage. (designed to be driven by gpio webhook server) The motivating use cases are:
This sketch currently targets only the ESP8266, and will probably not work with other microcontrollers. Support for other boards may come if I run out of ESP8266s.
cp config.h.example config.h
config.h and fill in the correct values for your environment.
config.h is an array of pins that we want to control. Each item in the array is itself an
array, with the following format:
The index of the item in the top-level array is its 'index' value in the webhook. (see webhook data, below)
output_pin is the pin to control.
control_mode is either 0 or 1. 0 is for momentary mode; that is, when the state is active the pin will
only be high for a short time. 1 is for latched mode; the pin will stay high until the state changes.
make to build the code. You need to have
The webhook should always return a page in the following (JSON-compatible) format:
[state_0, state_1, ...]
Where index and state are both integers. If you are expecting momentary input, you should return the state to '0' after the page is served / the webhook is consumed.