Skip to content

Instantly share code, notes, and snippets.

@Arachnid
Created August 16, 2011 07:17
Show Gist options
  • Save Arachnid/1148600 to your computer and use it in GitHub Desktop.
Save Arachnid/1148600 to your computer and use it in GitHub Desktop.
sscanf example for decoding colors
char data[10];
for(int i = 0; i < 9; i++)
data[i] = Serial.read();
data[9] = '\0';
int r, g, b;
sscanf(data, "%3x%3x%3x", &r, &g, &b);
// r, g and b now contain the color values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment