From 6bb63c68bdb717e1848444a69dc5cf5decc864a0 Mon Sep 17 00:00:00 2001 From: Juergen Jung Date: Tue, 31 Jan 2017 20:13:45 +0100 Subject: [PATCH] Change larson scanner --- esp-wemos-schild/esp-wemos-schild.ino | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/esp-wemos-schild/esp-wemos-schild.ino b/esp-wemos-schild/esp-wemos-schild.ino index 13e198c..155be69 100644 --- a/esp-wemos-schild/esp-wemos-schild.ino +++ b/esp-wemos-schild/esp-wemos-schild.ino @@ -5,7 +5,7 @@ #include #define PIN D1 -#define NUMPIXELS 144 +#define NUMPIXELS 30 uint16_t effectI=0,effectJ=0,wait = 50; unsigned long lastCall = 0; @@ -32,6 +32,13 @@ uint32_t wheel(byte wheelPos) { return pixels.Color(wheelPos * 3, 255 - wheelPos * 3, 0); } +void getRGBValues(uint32_t *rgbBuffer,uint32_t const color){ + rgbBuffer[0] = color >> 16 & 255; + rgbBuffer[1] = color >> 8 & 255; + rgbBuffer[2] = color & 255; + return ; +} + bool onSetPixel(const HomieRange& range, const String& value){ if(!range.isRange){ for(int i=0;i 0; i--) { pixels.clear(); pixels.show(); - pixels.setPixelColor(i, 255/10, 0, 0); + getRGBValues(rgb,wheel(wPos)); + pixels.setPixelColor(i, rgb[0]/10, rgb[1]/10, rgb[2]/10); + //pixels.setPixelColor(i, 255/10, 0, 0); for(int j = 1; j <= EyeSize; j++) { //pixels.setPixelColor(i+j, 255, 0, 0); pixels.setPixelColor(i+j, wheel(wPos++)); } - pixels.setPixelColor(i+EyeSize+1, 255/10, 0, 0); + pixels.setPixelColor(i+EyeSize+1, rgb[0]/10, rgb[1]/10, rgb[2]/10); pixels.show(); delay(SpeedDelay); }