Skip to content

Instantly share code, notes, and snippets.

@houmei
Created March 13, 2014 15:14
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Energia example : LaunchPad Stellaris
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pin as an output.
pinMode(RED_LED, OUTPUT);
pinMode(GREEN_LED, OUTPUT);
pinMode(BLUE_LED, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
for (int i=0;i<256;i++) {
if (i & 0x1) {
digitalWrite(RED_LED, HIGH);
} else {
digitalWrite(RED_LED, LOW);
}
if (i & 0x2) {
digitalWrite(GREEN_LED, HIGH);
} else {
digitalWrite(GREEN_LED, LOW);
}
if (i & 0x4) {
digitalWrite(BLUE_LED, HIGH);
} else {
digitalWrite(BLUE_LED, LOW);
}
delay(500);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment