Hello everyone! I need some help with a project. I am not a coder and know next to nothing about it. I made a sunrise alarm clock to help me get out of bed in the early mornings. I found some code online but had a friend modify it so that I could use it with my phone through Blynk Legacy. As you know, when Blynk switched over, it no longer works. The light consists of 9 strips of both White and RGB LED’s, each set with its own power supply, connected to a NodeMCU-12e board with an ESP8266. I got my device connected to the new Blynk, and I did my best at trying to get it to work by copying and pasting the old code into the new format and changing the virtual pins where needed, but I was unsuccessful.
Here is what is current:
- White Light Button (V13) - Simple on and off; works perfectly.
- Reset Button (V12) - Turns all lights, or timing sequence off; works perfectly.
Issues: - ZeRGBa (V11) - RGB lights turn on when I use the widget, but in no relation to the RGB values stated on the screen. And when I set to 0-0-0 they don’t turn off. The reset button does turn them off. Note: This is roughly what it did back when my sunrise sequence was working with Blynk Legacy. Since the sunrise was the most important thing to me, I didn’t bother trying to fix it, but would really love for this option to work.
- Time input (V10) - This is the most important. When I use the widget to select a time, the sequence turns on immediately, which is great that the sequence “works”, but it wont turn on when I need it to, only when immediately interacting with the widget itself.
Can y’all please help me out? I’d love to get this working again. I spent 5 hours yesterday trying to get this to work and it makes me frustrated and tired, lol. I don’t understand code, and don’t think I ever will at this point. Many of your replies will fly over my head. If you could put them in layman’s terms that would be amazing. I am smart, so I can work my way through some things, but I also don’t know what I don’t know. If y’all can help me, I’d greatly appreciate it. Thanks!
Here is the code I currently have on the device:
/*************************************************************
This is a simple demo of sending and receiving some data.
Be sure to check out other examples!
*************************************************************/
/* Fill-in information from Blynk Device Info here */
#define BLYNK_TEMPLATE_ID "MytemplateID"
#define BLYNK_TEMPLATE_NAME "Mytemplatename"
#define BLYNK_AUTH_TOKEN "Mytoken"
#define PIN D2
#define NUM_WHITE_PIXELS 270
#define NUM_RGB_PIXELS 135
#define BLYNK_PRINT Serial
#define PWM_RANGE_FULL 1024
//number of rows is 9 for both RGB and white LED's
#define NUM_ROWS 9
#include <Adafruit_NeoPixel.h>
#include <SPI.h>
#include <TimerEvent.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "Mynetwork";
char pass[] = "Mypassword";
// This function is called every time the device is connected to the Blynk.Cloud
BLYNK_CONNECTED()
{
// Change Web Link Button message to "Congratulations!"
Blynk.setProperty(V9, "offImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations.png");
Blynk.setProperty(V9, "onImageUrl", "https://static-image.nyc3.cdn.digitaloceanspaces.com/general/fte/congratulations_pressed.png");
Blynk.setProperty(V9, "url", "https://docs.blynk.io/en/getting-started/what-do-i-need-to-blynk/how-quickstart-device-was-made");
}
// This function sends Arduino's uptime every second to Virtual Pin 8.
void myTimerEvent()
{
// You can send any value at any time.
// Please don't send more that 10 values per second.
Blynk.virtualWrite(V8, millis() / 1000);
}
Adafruit_NeoPixel RGB_pixels = Adafruit_NeoPixel(NUM_RGB_PIXELS, PIN, NEO_GRB + NEO_KHZ800);
const int timerInterval = 1600;
const int numFrames = 974;
const int white_offset = 300;
unsigned int count = 0;
bool active = false;
bool whites_on = false;
TimerEvent timer;
int sunrise[][3] = {
{1, 1, 1},
{1, 1, 0},
{1, 1, 0},
{1, 1, 2},
{0, 1, 3},
{0, 1, 2},
{1, 1, 3},
{1, 1, 6},
{2, 1, 7},
{2, 1, 7},
{1, 1, 7},
{2, 1, 7},
{2, 1, 7},
{1, 0, 8},
{1, 0, 12},
{1, 1, 13},
{1, 1, 13},
{2, 2, 15},
{1, 1, 17},
{1, 1, 16},
{2, 2, 17},
{2, 2, 18},
{3, 2, 20},
{3, 2, 18},
{2, 1, 20},
{3, 2, 22},
{3, 2, 22},
{3, 3, 24},
{2, 2, 27},
{2, 3, 29},
{2, 3, 29},
{2, 5, 30},
{1, 3, 31},
{1, 3, 31},
{2, 5, 34},
{2, 5, 36},
{3, 5, 37},
{3, 5, 39},
{1, 5, 40},
{0, 6, 42},
{1, 6, 42},
{2, 6, 44},
{1, 6, 46},
{2, 6, 48},
{2, 6, 48},
{3, 7, 50},
{5, 7, 53},
{5, 7, 54},
{3, 7, 55},
{3, 8, 56},
{5, 8, 58},
{5, 8, 59},
{5, 7, 61},
{5, 8, 63},
{5, 8, 61},
{3, 8, 63},
{3, 8, 64},
{5, 8, 66},
{5, 8, 68},
{6, 8, 69},
{5, 7, 68},
{5, 7, 69},
{6, 8, 70},
{6, 8, 70},
{7, 10, 72},
{7, 10, 73},
{6, 8, 73},
{7, 8, 74},
{7, 8, 75},
{7, 10, 78},
{7, 10, 79},
{6, 10, 80},
{6, 10, 82},
{6, 8, 80},
{7, 10, 82},
{7, 10, 83},
{8, 11, 85},
{7, 10, 84},
{8, 11, 85},
{8, 11, 88},
{10, 12, 89},
{10, 11, 89},
{10, 11, 90},
{8, 11, 92},
{7, 11, 92},
{7, 12, 93},
{7, 13, 93},
{8, 12, 96},
{7, 11, 97},
{7, 11, 96},
{8, 12, 97},
{8, 12, 99},
{10, 13, 101},
{10, 13, 99},
{8, 12, 101},
{10, 13, 102},
{10, 12, 103},
{11, 15, 103},
{12, 16, 103},
{11, 13, 104},
{11, 13, 106},
{12, 13, 109},
{11, 13, 111},
{11, 15, 112},
{10, 13, 112},
{10, 13, 112},
{7, 12, 112},
{8, 12, 111},
{8, 15, 112},
{10, 16, 114},
{10, 16, 114},
{10, 17, 113},
{8, 17, 114},
{8, 17, 113},
{8, 17, 114},
{8, 16, 112},
{11, 16, 118},
{13, 16, 120},
{17, 17, 120},
{18, 18, 120},
{18, 18, 120},
{10, 11, 118},
{12, 13, 118},
{35, 35, 118},
{36, 36, 119},
{36, 35, 118},
{35, 35, 117},
{38, 39, 127},
{37, 37, 127},
{37, 36, 125},
{39, 37, 128},
{40, 37, 129},
{41, 37, 131},
{41, 37, 133},
{41, 36, 133},
{41, 36, 135},
{43, 37, 136},
{44, 38, 138},
{44, 38, 140},
{44, 37, 140},
{44, 36, 140},
{45, 36, 139},
{45, 36, 139},
{45, 37, 140},
{45, 38, 142},
{47, 38, 143},
{48, 38, 144},
{49, 37, 145},
{50, 38, 146},
{50, 37, 147},
{51, 39, 149},
{51, 40, 149},
{51, 39, 149},
{52, 38, 151},
{54, 38, 155},
{55, 37, 157},
{54, 37, 156},
{55, 37, 157},
{57, 38, 159},
{57, 38, 160},
{58, 38, 161},
{59, 38, 161},
{60, 38, 162},
{60, 39, 163},
{61, 39, 164},
{63, 38, 165},
{64, 38, 165},
{64, 38, 165},
{63, 38, 162},
{64, 39, 161},
{65, 39, 162},
{65, 39, 164},
{66, 39, 165},
{68, 39, 166},
{69, 39, 165},
{68, 39, 165},
{70, 39, 166},
{70, 39, 168},
{71, 40, 169},
{71, 39, 169},
{73, 39, 169},
{73, 39, 170},
{75, 38, 173},
{75, 38, 174},
{76, 38, 174},
{77, 36, 175},
{79, 35, 176},
{79, 36, 176},
{80, 35, 175},
{81, 35, 175},
{82, 35, 176},
{82, 35, 177},
{83, 34, 178},
{85, 34, 177},
{86, 33, 177},
{86, 33, 178},
{85, 33, 179},
{85, 33, 180},
{87, 33, 180},
{87, 31, 181},
{88, 30, 181},
{88, 31, 180},
{89, 29, 182},
{91, 28, 183},
{92, 27, 184},
{94, 26, 183},
{96, 25, 185},
{96, 25, 184},
{96, 25, 184},
{96, 24, 185},
{97, 24, 189},
{98, 23, 190},
{99, 22, 190},
{100, 22, 188},
{100, 21, 189},
{100, 21, 189},
{101, 19, 191},
{102, 18, 191},
{103, 16, 191},
{104, 16, 191},
{105, 14, 190},
{106, 12, 191},
{105, 13, 190},
{106, 12, 192},
{108, 10, 194},
{108, 9, 196},
{109, 9, 196},
{110, 9, 195},
{112, 8, 197},
{113, 7, 197},
{114, 6, 197},
{115, 5, 197},
{116, 4, 197},
{117, 4, 197},
{118, 3, 198},
{118, 3, 198},
{119, 3, 198},
{120, 2, 199},
{119, 0, 203},
{119, 1, 204},
{119, 1, 204},
{122, 1, 204},
{124, 0, 204},
{124, 0, 204},
{125, 0, 205},
{128, 0, 205},
{130, 0, 206},
{131, 0, 206},
{133, 0, 206},
{134, 0, 207},
{134, 0, 207},
{135, 0, 207},
{134, 0, 207},
{134, 0, 207},
{134, 0, 207},
{135, 0, 208},
{136, 1, 209},
{137, 1, 209},
{138, 1, 210},
{139, 1, 209},
{139, 1, 211},
{140, 1, 211},
{140, 2, 211},
{142, 1, 212},
{142, 1, 213},
{141, 2, 211},
{141, 3, 208},
{142, 2, 206},
{142, 2, 206},
{142, 3, 207},
{144, 3, 208},
{144, 2, 208},
{145, 3, 208},
{146, 4, 208},
{148, 5, 208},
{148, 6, 208},
{149, 6, 209},
{149, 6, 209},
{149, 6, 209},
{151, 8, 210},
{156, 8, 209},
{158, 8, 209},
{157, 8, 210},
{158, 9, 210},
{159, 10, 211},
{159, 11, 210},
{160, 12, 210},
{160, 12, 211},
{161, 13, 212},
{162, 13, 213},
{162, 14, 212},
{163, 14, 211},
{163, 15, 212},
{164, 16, 212},
{166, 16, 211},
{167, 17, 213},
{167, 17, 213},
{168, 18, 212},
{169, 19, 213},
{169, 20, 214},
{170, 21, 215},
{170, 21, 215},
{171, 22, 214},
{172, 23, 214},
{172, 24, 215},
{172, 24, 216},
{172, 25, 216},
{174, 25, 216},
{177, 26, 216},
{178, 25, 216},
{179, 27, 216},
{179, 27, 215},
{180, 27, 215},
{180, 27, 215},
{181, 28, 215},
{181, 29, 215},
{182, 30, 217},
{183, 31, 217},
{184, 33, 217},
{185, 34, 217},
{185, 33, 217},
{185, 34, 216},
{185, 36, 215},
{185, 38, 216},
{186, 38, 217},
{186, 38, 216},
{187, 39, 215},
{188, 40, 216},
{189, 41, 217},
{189, 42, 217},
{190, 43, 217},
{191, 43, 216},
{191, 44, 217},
{192, 46, 217},
{192, 46, 217},
{193, 47, 217},
{194, 47, 219},
{195, 48, 219},
{195, 48, 218},
{194, 49, 218},
{196, 50, 219},
{197, 50, 219},
{199, 51, 219},
{199, 51, 218},
{200, 52, 218},
{201, 53, 219},
{203, 53, 219},
{204, 54, 219},
{205, 55, 219},
{204, 56, 218},
{204, 56, 216},
{203, 57, 215},
{204, 57, 215},
{204, 58, 215},
{205, 59, 215},
{206, 59, 215},
{208, 60, 215},
{208, 60, 216},
{209, 61, 216},
{209, 61, 217},
{211, 62, 217},
{212, 61, 217},
{212, 61, 217},
{211, 62, 217},
{212, 62, 217},
{213, 63, 217},
{214, 63, 218},
{215, 63, 217},
{215, 64, 214},
{215, 64, 215},
{217, 66, 214},
{217, 66, 213},
{218, 67, 213},
{220, 67, 213},
{220, 67, 211},
{219, 68, 210},
{220, 68, 209},
{221, 69, 210},
{221, 69, 212},
{222, 69, 213},
{223, 69, 212},
{224, 69, 211},
{226, 70, 209},
{226, 70, 209},
{227, 69, 208},
{228, 69, 205},
{229, 68, 204},
{229, 67, 203},
{231, 68, 200},
{233, 68, 200},
{233, 67, 199},
{232, 68, 199},
{232, 70, 200},
{233, 71, 201},
{233, 71, 200},
{235, 69, 199},
{236, 70, 196},
{236, 70, 194},
{237, 70, 193},
{238, 70, 191},
{239, 69, 190},
{240, 69, 188},
{241, 68, 187},
{242, 69, 185},
{242, 69, 186},
{243, 68, 185},
{244, 68, 183},
{245, 67, 183},
{247, 67, 182},
{246, 67, 181},
{247, 67, 179},
{247, 67, 178},
{248, 67, 176},
{247, 67, 175},
{248, 69, 173},
{249, 69, 171},
{250, 67, 169},
{251, 67, 168},
{251, 67, 168},
{249, 68, 167},
{247, 69, 166},
{246, 69, 164},
{247, 69, 164},
{248, 69, 161},
{249, 71, 159},
{249, 71, 159},
{249, 71, 158},
{249, 71, 156},
{249, 72, 153},
{249, 71, 151},
{250, 73, 149},
{251, 72, 147},
{251, 72, 147},
{251, 72, 146},
{250, 72, 142},
{252, 73, 140},
{252, 72, 139},
{250, 73, 140},
{252, 75, 138},
{252, 75, 135},
{252, 76, 132},
{252, 77, 132},
{252, 78, 131},
{252, 78, 128},
{253, 79, 126},
{252, 79, 125},
{252, 79, 125},
{253, 80, 121},
{254, 83, 113},
{254, 84, 110},
{254, 83, 109},
{254, 84, 108},
{255, 86, 105},
{255, 87, 104},
{255, 88, 100},
{255, 90, 96},
{254, 91, 93},
{254, 91, 90},
{255, 92, 88},
{255, 94, 88},
{255, 95, 87},
{255, 95, 82},
{255, 95, 76},
{254, 96, 73},
{254, 97, 72},
{255, 98, 70},
{255, 99, 64},
{255, 100, 59},
{255, 102, 56},
{254, 104, 53},
{255, 105, 50},
{255, 106, 47},
{255, 107, 45},
{255, 107, 44},
{255, 107, 44},
{255, 110, 42},
{253, 111, 38},
{252, 113, 36},
{252, 113, 35},
{252, 114, 34},
{253, 115, 32},
{253, 117, 31},
{252, 118, 29},
{252, 118, 27},
{252, 119, 25},
{252, 119, 24},
{253, 121, 23},
{252, 123, 21},
{252, 122, 21},
{252, 123, 19},
{252, 126, 15},
{252, 128, 13},
{252, 129, 13},
{253, 128, 12},
{253, 129, 11},
{253, 131, 11},
{252, 133, 9},
{252, 132, 7},
{253, 133, 5},
{253, 134, 4},
{254, 136, 3},
{254, 137, 2},
{254, 136, 1},
{253, 137, 0},
{252, 138, 2},
{253, 140, 2},
{253, 140, 1},
{254, 140, 2},
{253, 142, 2},
{253, 143, 1},
{254, 145, 0},
{254, 146, 0},
{253, 146, 0},
{253, 147, 0},
{254, 149, 0},
{254, 150, 0},
{253, 150, 0},
{253, 150, 0},
{253, 150, 0},
{253, 150, 0},
{253, 150, 0},
{253, 151, 0},
{253, 154, 0},
{253, 155, 0},
{253, 156, 1},
{253, 157, 1},
{252, 158, 2},
{251, 160, 2},
{252, 161, 3},
{252, 161, 4},
{251, 162, 4},
{251, 163, 5},
{252, 164, 6},
{253, 165, 7},
{254, 165, 7},
{253, 166, 9},
{253, 168, 10},
{253, 168, 11},
{252, 170, 12},
{252, 172, 13},
{251, 173, 14},
{252, 173, 15},
{251, 174, 16},
{250, 176, 17},
{251, 177, 17},
{252, 178, 19},
{253, 179, 21},
{253, 179, 21},
{253, 179, 21},
{254, 180, 23},
{253, 182, 26},
{253, 184, 27},
{253, 186, 28},
{253, 185, 30},
{252, 187, 31},
{252, 189, 31},
{252, 190, 33},
{253, 192, 37},
{252, 193, 36},
{253, 194, 39},
{252, 194, 44},
{252, 194, 46},
{252, 195, 46},
{251, 196, 47},
{252, 198, 49},
{252, 199, 50},
{252, 200, 52},
{252, 201, 54},
{251, 202, 56},
{251, 203, 59},
{252, 205, 61},
{251, 206, 63},
{250, 207, 64},
{251, 206, 64},
{252, 208, 62},
{253, 208, 62},
{253, 209, 63},
{254, 209, 64},
{255, 211, 65},
{255, 211, 66},
{254, 212, 68},
{254, 212, 70},
{254, 213, 71},
{254, 214, 71},
{254, 214, 72},
{253, 215, 74},
{253, 215, 74},
{254, 216, 75},
{254, 218, 80},
{255, 219, 83},
{255, 218, 84},
{255, 218, 84},
{255, 219, 85},
{255, 219, 86},
{254, 220, 87},
{254, 222, 88},
{254, 223, 89},
{254, 222, 91},
{255, 223, 93},
{255, 225, 95},
{254, 225, 94},
{254, 225, 95},
{254, 227, 96},
{253, 227, 97},
{253, 226, 98},
{254, 227, 99},
{253, 229, 100},
{253, 228, 101},
{253, 229, 103},
{253, 230, 103},
{254, 231, 104},
{254, 232, 105},
{253, 233, 106},
{254, 233, 108},
{255, 232, 108},
{254, 233, 109},
{252, 234, 112},
{252, 235, 113},
{252, 235, 112},
{253, 236, 114},
{253, 237, 116},
{253, 237, 116},
{252, 238, 117},
{252, 239, 118},
{253, 240, 121},
{253, 239, 122},
{253, 239, 122},
{253, 240, 122},
{253, 240, 124},
{253, 241, 124},
{251, 244, 124},
{252, 244, 124},
{251, 244, 123},
{252, 245, 124},
{252, 246, 125},
{252, 245, 127},
{253, 246, 129},
{253, 246, 130},
{253, 247, 131},
{253, 248, 132},
{253, 248, 132},
{253, 248, 132},
{253, 248, 133},
{253, 249, 136},
{253, 248, 141},
{252, 248, 143},
{252, 248, 142},
{253, 249, 142},
{253, 250, 144},
{253, 250, 145},
{252, 251, 146},
{252, 251, 146},
{253, 251, 147},
{253, 251, 147},
{253, 252, 149},
{252, 254, 149},
{252, 253, 148},
{252, 253, 149},
{253, 254, 151},
{253, 255, 152},
{253, 255, 150},
{253, 254, 152},
{254, 255, 154},
{254, 255, 154},
{255, 255, 156},
{255, 255, 159},
{254, 255, 160},
{254, 255, 161},
{255, 254, 163},
{255, 252, 164},
{255, 252, 164},
{254, 254, 163},
{253, 254, 164},
{253, 255, 164},
{253, 255, 164},
{253, 254, 165},
{253, 254, 167},
{253, 254, 168},
{253, 254, 169},
{253, 254, 171},
{253, 254, 173},
{253, 254, 174},
{254, 254, 176},
{254, 254, 177},
{254, 254, 177},
{253, 254, 176},
{252, 254, 174},
{251, 255, 174},
{251, 255, 174},
{251, 254, 174},
{252, 255, 176},
{252, 255, 179},
{253, 255, 181},
{253, 255, 183},
{252, 255, 184},
{252, 255, 184},
{254, 255, 186},
{253, 255, 186},
{253, 255, 186},
{253, 254, 187},
{253, 254, 190},
{253, 253, 192},
{253, 254, 192},
{253, 253, 193},
{254, 253, 195},
{254, 253, 195},
{254, 253, 196},
{254, 253, 196},
{253, 252, 199},
{253, 252, 201},
{254, 251, 203},
{255, 253, 203},
{255, 252, 204},
{254, 253, 204},
{254, 253, 204},
{253, 253, 203},
{253, 253, 204},
{254, 253, 205},
{253, 253, 206},
{253, 253, 206},
{254, 253, 207},
{254, 253, 207},
{255, 253, 208},
{255, 253, 209},
{254, 253, 211},
{255, 254, 210},
{255, 254, 210},
{254, 253, 211},
{253, 253, 212},
{252, 254, 213},
{252, 254, 213},
{253, 254, 212},
{253, 254, 213},
{253, 254, 213},
{253, 254, 213},
{253, 254, 213},
{253, 254, 213},
{253, 254, 213},
{253, 254, 213},
{252, 253, 212},
{252, 253, 212},
{253, 253, 213},
{253, 253, 215},
{253, 253, 216},
{253, 253, 216},
{253, 253, 215},
{254, 253, 217},
{254, 253, 217},
{254, 253, 218},
{254, 253, 218},
{254, 253, 218},
{254, 253, 217},
{254, 253, 218},
{253, 253, 218},
{253, 253, 218},
{254, 253, 219},
{254, 253, 221},
{255, 254, 222},
{255, 254, 222},
{254, 253, 221},
{255, 254, 222},
{255, 254, 222},
{255, 254, 222},
{255, 254, 222},
{255, 254, 222},
{255, 254, 222},
{255, 254, 222},
{255, 254, 221},
{255, 254, 221},
{255, 254, 221},
{255, 254, 220},
{255, 254, 220},
{255, 254, 220},
{255, 254, 220},
{255, 254, 221},
{255, 254, 221},
{255, 254, 221},
{255, 254, 221},
{255, 254, 221},
{255, 254, 221},
{255, 254, 221},
{255, 253, 219},
{255, 253, 219},
{255, 254, 221},
{255, 254, 226},
{255, 255, 229},
{255, 255, 228},
{255, 254, 227},
{255, 255, 228},
{255, 255, 228},
{255, 255, 228},
{255, 255, 228},
{255, 255, 228},
{255, 255, 228},
{255, 255, 228},
{255, 255, 227},
{255, 255, 227},
{255, 254, 228},
{255, 254, 229},
{255, 253, 230},
{255, 253, 230},
{255, 254, 229},
{255, 254, 230},
{255, 254, 230},
{255, 254, 230},
{255, 254, 230},
{255, 254, 230},
{255, 254, 230},
{255, 254, 230},
{255, 253, 229},
{255, 253, 229},
{255, 254, 230},
{255, 254, 231},
{255, 255, 231},
{255, 255, 231},
{255, 254, 231},
{255, 255, 231},
{255, 255, 231},
{255, 255, 231},
{255, 255, 231},
{255, 255, 231},
{255, 255, 231},
{255, 255, 231},
{255, 255, 230},
{255, 255, 230},
{255, 254, 231},
{255, 253, 234},
{255, 253, 235},
{255, 253, 235},
{255, 253, 234},
{255, 253, 235},
{255, 253, 235},
{255, 253, 235},
{255, 253, 235},
{255, 253, 235},
{255, 253, 235},
{255, 253, 235},
{255, 253, 235},
{255, 253, 235},
{255, 253, 235},
{255, 253, 235},
{255, 254, 236},
{255, 254, 236},
{255, 253, 236},
{255, 254, 236},
{255, 254, 236},
{255, 254, 237},
{255, 254, 237},
{255, 254, 237},
{255, 254, 237},
{255, 254, 236},
{255, 254, 235},
{255, 254, 235},
{255, 254, 236},
{255, 254, 239},
{255, 254, 241},
{255, 254, 241},
{255, 254, 239},
{255, 254, 240},
{255, 254, 240},
{255, 254, 240},
{255, 254, 240},
{255, 254, 240},
{255, 254, 240},
{255, 254, 240},
{255, 254, 239},
{255, 254, 239},
{254, 254, 240},
{254, 254, 241},
{253, 255, 242},
{253, 255, 242},
{254, 254, 241},
{254, 255, 242},
{254, 255, 242},
{254, 255, 242},
{254, 255, 242},
{254, 255, 241},
{254, 255, 241},
{254, 255, 242},
{254, 255, 240},
{254, 255, 240},
{254, 254, 241},
{254, 254, 244},
{254, 253, 245},
{254, 253, 245},
{254, 254, 244},
{254, 254, 245},
{254, 254, 245},
{254, 254, 245},
{254, 254, 245},
{254, 254, 245},
{254, 254, 245},
{254, 254, 245},
{254, 254, 246},
{254, 254, 246},
{254, 254, 245},
{254, 254, 244},
{254, 254, 243},
{254, 254, 243},
{254, 254, 244},
{254, 254, 243},
{254, 254, 243},
{254, 254, 243},
{254, 254, 243},
{254, 254, 243},
{254, 254, 243},
{254, 254, 243},
{253, 253, 242},
{253, 253, 242},
{254, 254, 243},
{254, 254, 245},
{255, 255, 246},
{255, 255, 246},
{254, 254, 245},
{255, 255, 246},
{255, 255, 246},
{255, 255, 246},
{255, 255, 246},
{255, 255, 246},
{255, 255, 246},
{255, 255, 246},
{255, 255, 245},
{255, 255, 245},
{255, 254, 246},
{255, 254, 248},
{255, 253, 249},
{255, 253, 249},
{255, 254, 248},
{255, 254, 249},
{255, 254, 249},
{255, 254, 249},
{255, 254, 249},
{255, 254, 249},
{255, 254, 249},
{255, 254, 249},
{255, 253, 247},
{255, 253, 247},
{254, 254, 249},
{254, 254, 249},
{253, 255, 250},
{253, 255, 250},
{254, 254, 249},
{254, 255, 250},
{254, 255, 250},
{254, 255, 250},
{254, 255, 250},
{254, 255, 250},
{254, 255, 250},
{254, 255, 250},
{254, 255, 249},
{254, 255, 249},
{254, 254, 250},
{254, 254, 251},
{254, 253, 252},
{254, 253, 252},
{254, 254, 251},
{254, 254, 252},
{254, 254, 252},
{254, 254, 252},
{254, 254, 252},
{254, 254, 252},
{254, 254, 252},
{254, 254, 252},
{253, 253, 251},
{253, 253, 251},
{253, 253, 252},
{254, 254, 253},
{254, 254, 254},
{254, 254, 254},
{254, 254, 254},
{254, 254, 254},
{255, 255, 255},
{255, 255, 255},
{255, 255, 255},
};
void setup() {
Serial.begin(9600);
pinMode(14,OUTPUT);
Blynk.begin("Mytoken", "Mynetwork", "Mypassword");
RGB_pixels.begin();
}
//Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_RGB_PIXELS, PIN, NEO_GRB + NEO_KHZ800);
// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
//uint32_t Wheel(byte WheelPos) {
// if (WheelPos < 85) {
// return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
// } else if (WheelPos < 170) {
// WheelPos -= 85;
// return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
// } else {
// WheelPos -= 170;
// return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
// }
//}
BLYNK_WRITE(V11)
{
int r, g, b;
digitalWrite(14,LOW);
int shift = param.asInt();
if(shift < 85){
r = shift*3;
g = 255-shift*3;
b = 0;
}else if (shift < 170){
shift -= 85;
r = 255-shift*3;
g = 0;
b = shift * 3;
}else{
shift -=170;
r = 0;
g = shift *3;
b = 255- shift * 3;
}
for (int i = 0; i < RGB_pixels.numPixels(); i++)
{
RGB_pixels.setPixelColor(i, RGB_pixels.Color(r, g, b));
// OR: strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + shift) & 255));
}
RGB_pixels.show();
}
//Just count
void changePixels(){
if (count < numFrames) {
count++;
if (count >= (numFrames-white_offset)){
float level = (count - (numFrames-white_offset))/float(white_offset);
if(level > 0.65){
digitalWrite(14, HIGH);
}else{
digitalWrite(14, LOW);
}
}
for (int i=0; i < RGB_pixels.numPixels(); i++){
RGB_pixels.setPixelColor(i, RGB_pixels.Color(sunrise[count][0], sunrise[count][1], sunrise[count][2]));
}
RGB_pixels.show();
}
if (count == numFrames){
RGB_pixels.clear();
RGB_pixels.show();
digitalWrite(14, HIGH);
timer.disable();
active = false;
count++;
}
}
BLYNK_WRITE(V12){
if(active==true) {
timer.disable();
active = false;
}
count =0;
digitalWrite(14,LOW);
whites_on = false;
RGB_pixels.clear();
RGB_pixels.show();
}
BLYNK_WRITE(V13){
if(whites_on){
digitalWrite(14, LOW);
whites_on = false;
}else{
digitalWrite(14,HIGH);
whites_on = true;
}
}
BLYNK_WRITE(V10){
count = 0;
timer.enable();
active = true;
whites_on = true;
timer.set(timerInterval, changePixels);
}
void loop() {
if(active == true) timer.update();
Blynk.run();
}