diff --git a/platformio.ini b/platformio.ini index 972848a..016561f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -9,7 +9,7 @@ ; http://docs.platformio.org/page/projectconf.html [platformio] -env_default = button +env_default = illucat [common] framework = arduino diff --git a/src/examples/button/Button.h b/src/examples/button/Button.h index f26d90a..45a0daa 100644 --- a/src/examples/button/Button.h +++ b/src/examples/button/Button.h @@ -13,13 +13,14 @@ class Button : public Sprocket { Task btnTask; MeshNet* net; int pin; + int warnlevel = 0; Button(SprocketConfig cfg) : Sprocket(cfg) {} Sprocket* activate(Scheduler* scheduler, Network* network) { pin = D2; pinMode(pin, INPUT_PULLUP); net = static_cast(network); net->mesh.onReceive(bind(&Button::receivedCallback,this, _1, _2)); - btnTask.set(TASK_MILLISECOND * 500, TASK_FOREVER, + btnTask.set(TASK_MILLISECOND * 250, TASK_FOREVER, bind(&Button::readPin, this, net)); scheduler->addTask(btnTask); btnTask.enable(); @@ -27,8 +28,9 @@ class Button : public Sprocket { void readPin(MeshNet* network){ if(digitalRead(pin)){ - Serial.println("btn pressed"); - network->broadcast("EE1B2E"); + Serial.println("warnlevel: " + String(warnlevel)); + warnlevel++; + network->broadcast(String(warnlevel)); } } diff --git a/src/examples/illucat/Illucat.h b/src/examples/illucat/Illucat.h index 0991f6c..dbc80fa 100644 --- a/src/examples/illucat/Illucat.h +++ b/src/examples/illucat/Illucat.h @@ -20,6 +20,8 @@ class Illucat : public Sprocket { NeoPattern* pixels; Illucat(SprocketConfig cfg, NeoPixelConfig pixelCfg) : Sprocket(cfg) { pixels = new NeoPattern(pixelCfg.length, pixelCfg.pin, NEO_GRB + NEO_KHZ800, [](int pixels){}); + pixels->begin(); + pixels->setBrightness(64); } Sprocket* activate(Scheduler* scheduler, Network* network) { net = static_cast(network);