diff --git a/Makefile b/Makefile index 6d4e107..c23101f 100644 --- a/Makefile +++ b/Makefile @@ -1,2 +1,12 @@ +BOARD_NAME ?= esp8266:esp8266:huzzah +UPLOAD_PORT ?= /dev/ttyUSB0 + +.PHONY: all build upload + +all: build + build: - arduino-cli compile -b esp8266:esp8266:huzzah smartswitch.ino + arduino-cli compile -b ${BOARD_NAME} smartswitch.ino + +upload: + arduino-cli upload -b ${BOARD_NAME} -p ${UPLOAD_PORT} smartswitch.ino diff --git a/config.h.example b/config.h.example index 9d533b5..ef45f82 100644 --- a/config.h.example +++ b/config.h.example @@ -8,14 +8,12 @@ // // We would expect the webhook to return something like: // -// 0 1 -// 1 0 -// 2 1 +// [1 0 1] // // to activate the momentary switch, (pin 5) deactivate the first // latched switch, (pin 8) and activate the second latched switch. (pin 10) const int PIN_MAP[][2] = { - {5, 0}, + {5, 1}, {8, 1}, {10, 1} }; diff --git a/readme.md b/readme.md index 6bde03a..688a65c 100644 --- a/readme.md +++ b/readme.md @@ -41,12 +41,10 @@ only be high for a short time. 1 is for latched mode; the pin will stay high unt ## Webhook data -The webhook should always return a page in the following format: +The webhook should always return a page in the following (JSON-compatible) format: ``` -index_0 state_0 -index_1 state_1 -... +[state_0, state_1, ...] ``` Where index and state are both integers. If you are expecting momentary input, you should return the