Created
May 20, 2015 02:41
-
-
Save ranisalt/7c41786dd76343187f05 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Configure pings accordingly | |
enum LED_PINS { | |
LED_RED = 0, | |
LED_GREEN = 1, | |
LED_BLUE = 2, | |
LED_PWM = 3 | |
}; | |
void writeColor(int color) { | |
GPIO_Pin red(LED_RED), green(LED_GREEN), blue(LED_BLUE), pwm(LED_PWM); | |
red.put((char)(color >> 24)); | |
green.put((char)(color >> 16 & 0xFF)); | |
blue.put((char)(color >> 8 & 0xFF)); | |
pwm.put((char)(color & 0xFF)); | |
} | |
int main() { | |
writeColor(0xFF00FFFF); // purple, full luminosity | |
writeColor(0x00FF8080); // aqua, half-luminosity | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment