Amazon Alexa Controlled LED Strip Lights

  • Post category:Uncategorized
  • Post comments:0 Comments
  • Post last modified:December 21, 2020
  • Reading time:2 mins read

Disclosure: Some of the links below are affiliate links, meaning, at no additional cost to you, we will earn a commission if you click through and make a purchase..

Amazon Alexa Controlled LED Strip Lights 1
void trans(const char *event, const char *data){ String responsevalue = String(1); Particle.publish(“response”, responsevalue, PRIVATE); delay(2000); if (strcmp(data, “lights_off”)==0) { analogWrite(A0, 255); //blue analogWrite(A1, 255); //green analogWrite(A2, 255); //red } else if (strcmp(data, “blue”)==0) { analogWrite(A0, 0); analogWrite(A1, 255); analogWrite(A2, 255); } else if (strcmp(data, “green”)==0) { analogWrite(A0, 255); analogWrite(A1, 0); analogWrite(A2, 255); } else if (strcmp(data, “red”)==0) { analogWrite(A0, 255); analogWrite(A1, 255); analogWrite(A2, 0); } else if (strcmp(data, “orange”)==0) { analogWrite(A0, 255); analogWrite(A1, 127); analogWrite(A2, 0); } else if (strcmp(data, “yellow”)==0) { analogWrite(A0, 255); analogWrite(A1, 0); analogWrite(A2, 0); } else if (strcmp(data, “purple”)==0) { analogWrite(A0, 0); analogWrite(A1, 255); analogWrite(A2, 0); } else if (strcmp(data, “pink”)==0) { analogWrite(A0, 127); analogWrite(A1, 255); analogWrite(A2, 0); } //hard code blinking yellow and green every 2 seconds //analogWrite(A0,255); // yellow //analogWrite(A1,0); //analogWrite(A2,0); //delay(2000); //analogWrite(A0,255); // green //analogWrite(A1,0); //analogWrite(A2,255); //delay(2000); else if (strcmp(data, “party_lights”)==0 || strcmp(data, “party_lights”) !=0) { analogWrite(A0, 0); // blue analogWrite(A1, 255); analogWrite(A2, 255); analogWrite(A0, 255); //off analogWrite(A1, 255); analogWrite(A2, 255); delay(1500); analogWrite(A0, 255); // green analogWrite(A1, 0); analogWrite(A2, 255); analogWrite(A0, 255); analogWrite(A1, 255); //off analogWrite(A2, 255); delay(1500); analogWrite(A0, 255); analogWrite(A1, 255); //red analogWrite(A2, 0); analogWrite(A0, 255); analogWrite(A1, 255); // off analogWrite(A2, 255); delay(1500); analogWrite(A0, 0); analogWrite(A1, 255); // aqua analogWrite(A2, 127); analogWrite(A0, 255); analogWrite(A1, 255); // off analogWrite(A2, 255); delay(1500); analogWrite(A0, 0); analogWrite(A1, 255); // purple analogWrite(A2, 0); analogWrite(A0, 255); // off analogWrite(A1, 255); analogWrite(A2, 255); delay(1500); analogWrite(A0, 255); //orange analogWrite(A1, 127); analogWrite(A2, 0); analogWrite(A0, 255); // off analogWrite(A1, 255); analogWrite(A2, 255); delay(1500); analogWrite(A0, 255); analogWrite(A1, 0); // yellow analogWrite(A2, 0); analogWrite(A0, 255); analogWrite(A1, 255); // off analogWrite(A2, 255); delay(1500); analogWrite(A0, 0); analogWrite(A1, 255); // light blue analogWrite(A2, 127); analogWrite(A0, 255); analogWrite(A1, 255); // off analogWrite(A2, 255); delay(1500); analogWrite(A0, 0); analogWrite(A1, 0); // white analogWrite(A2, 0); analogWrite(A0, 255); analogWrite(A1, 255); // off analogWrite(A2, 255); } else {} delay(1000); } void setup() { pinMode(A0, OUTPUT); //blue pinMode(A1, OUTPUT); //green pinMode(A2, OUTPUT); //red }

Source

Leave a Reply