Hello
I want to create a wifi rgb controller with a nodemcu and Blynk. All of it should be controlled by my Google home, so I am using IFTTT. Now since I am building a RGB controller I want to be able to change the color of my RGB strip with a single command to my Google Home. My question is how do I make two web requests in one applet to lets say turn the red component of my RGB strip off and the blue and green on. Is it something I need to configure in the Blynk app?
This might also only be a IFTTT thing and not with Blynk but I still ask for your support.
Thank you
I’m an Amazon Alexa user rather than Google, but I think the issues are similar. My thoughts (after using Blynk controlled RGB striplights for some time) is that you rarely want to set the LEDs specific values unless you’re ‘playing’ or ‘showing-off’ the system.
Most of the time it’s presets like ‘warm’ or ‘cool’ or maybe ‘preset 1’, ‘preset 2’ etc.
If that’s the case then I’d hard-code those values into the code running on your MCU that has the RGB controller attached. Over time you might want to tweak those colours a bit, but that’s easily achieved with an OTA update of the code.
I have a slider for each colour in my Blynk app, then simply use Alexa to turn the lights on or off. I don’t really go for different ‘moods’, but if I did then I wouldn’t even bother using Alexa for these, I’d do it in Blynk.
Pete.
you can sent the RGB value as string to a virtual pin and then using strchr
to split it and change the color one shoot.
below is an example of how to use it , rewrite it for your RGB code
char header[] = "s=123 d=789 e=463";`
int d, s, e; //your variables to be assigned to
char * ptr = header;
char * eq = NULL; //locate assmts
int * num = NULL; //just for starters
while (1){
eq = strchr(ptr, '=');
ptr = eq; // update the pointer
if (ptr == NULL) // found no = chars
break;
switch (*(ptr - 1)){
case 'd': //all the possible variables
num = &d; break;
case 's':
num = &s; break;
case 'e':
num = &e; break;
default: //unknown variable
num = NULL;
}
ptr++;
if (num == NULL) //unrecognized var
continue; // locate next = char
*num = 0;
while (*ptr && (*ptr != ' ')){ // while space or end of string not yet reached
*num *= 10; // extract each int
*num += *ptr - '0';
ptr++;
}
}
Serial.println(d); //now contains the numbers in the header
Serial.println(s);
Serial.println(e);
Or search how to use Arduino strtok_r()
function to split text