Guest User

Untitled

a guest
Dec 26th, 2015
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. #define INPUT_SIZE 6
  2.  
  3. void loop() {
  4.   if(Serial.available()) {
  5.     char input[INPUT_SIZE];
  6.     Serial.readBytes(input, INPUT_SIZE);
  7.    
  8.     long colorcode = (long) strtol(input, NULL, 16);
  9.     color[0] = colorcode >> 16;
  10.     color[1] = colorcode >> 8 & 0xFF;
  11.     color[2] = colorcode & 0xFF;
  12.  
  13.     setColor(color);
  14.   }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment