Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void loop() {
- if(Serial.available()) {
- if(Serial.read().first(8) == "0xABCDEF") {
- //0xABCDEF is basically my indicator saying "this is for individual LEDs"
- //Serial.read() can now be something like 0xABCDEF FF0000 00FF00 0000FF FFFFFF 000000
- char* colors[] = Serial.read().split(" ");
- colorLED(colors);
- }
- }
- }
- void colorLED(colors) {
- for(i = 1; i < colors.length; i++) {
- strip.SetPixelColor(i, color[i]);
- }
- }
- //hexColor can be "FF0000"
- int number = (int)strtol(&hexColor[0], NULL, 16);
- int r = number >> 16;
- int g = number >> 8 & 0xFF;
- int b = number & 0xFF;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement