From e5f974fe5e6ace04380fc995898598fe7a7faf3d Mon Sep 17 00:00:00 2001 From: mrcory <33401433+mrcory@users.noreply.github.com> Date: Fri, 24 May 2019 11:29:54 -0400 Subject: [PATCH] Added RGB Zebra support --- shade_controller/shade_controller.ino | 15 ++++++++------- shade_controller/wifi.h | 6 ++++++ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/shade_controller/shade_controller.ino b/shade_controller/shade_controller.ino index 018dfb2..05091fa 100644 --- a/shade_controller/shade_controller.ino +++ b/shade_controller/shade_controller.ino @@ -28,7 +28,7 @@ FASTLED_USING_NAMESPACE #define NUM_LEDS 9 -#define DATA_PIN 3 +#define DATA_PIN D1 #define LED_TYPE WS2812 #define COLOR_ORDER GRB @@ -63,6 +63,7 @@ byte ledMode = 0; bool lightOn = false; bool lightOld = true; int oldBrightness = ledBrightness; +int currentColor[3] = {255,255,255}; #include "wifi.h" @@ -143,7 +144,7 @@ int oldBrightness = ledBrightness; void setup() { - FastLED.addLeds(leds, NUM_LEDS).setCorrection(TypicalLEDStrip); + FastLED.addLeds(leds, NUM_LEDS);//.setCorrection(TypicalLEDStrip); pinMode(ledPin,OUTPUT); digitalWrite(ledPin,LOW); @@ -228,8 +229,10 @@ void loop() { if (ledBrightness != oldBrightness) { FastLED.setBrightness(ledBrightness); - FastLED.show(); } + + FastLED.show(); + } stepper.run(); //AccelStepper runs here @@ -242,14 +245,12 @@ void loop() { void lightControl() { - if (lightOn == true && lightOld != lightOn) { - fill_solid(leds,NUM_LEDS,CRGB::White); - FastLED.show(); + if (lightOn == true) { + fill_solid(leds,NUM_LEDS,CRGB(currentColor[0],currentColor[1],currentColor[2])); } if (lightOn == false && lightOld != lightOn) { fill_solid(leds,NUM_LEDS,CRGB(0,0,0)); - FastLED.show(); } lightOld = lightOn; } diff --git a/shade_controller/wifi.h b/shade_controller/wifi.h index 40b996a..c647b50 100644 --- a/shade_controller/wifi.h +++ b/shade_controller/wifi.h @@ -30,3 +30,9 @@ BLYNK_WRITE(V22) { ledBrightness = param.asInt(); } +BLYNK_WRITE(V23) { + currentColor[0] = param[0].asInt(); + currentColor[1] = param[1].asInt(); + currentColor[2] = param[2].asInt(); +} +