Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#define PIN_BLINK_LED_BLUE 11
#define PIN_BLINK_LED_RED 9
#define PIN_BLINK_LED_GREEN 10
void setup() {
// put your setup code here, to run once:
pinMode( PIN_BLINK_LED_BLUE, OUTPUT );
pinMode( PIN_BLINK_LED_RED, OUTPUT );
pinMode( PIN_BLINK_LED_GREEN, OUTPUT );
digitalWrite( PIN_BLINK_LED_BLUE, LOW );
digitalWrite( PIN_BLINK_LED_RED, HIGH );
digitalWrite( PIN_BLINK_LED_GREEN, LOW );
}
void lightMe( int led1, int led2 ) {
for(int i = 0; i < 10; i++) {
analogWrite( led1, 255 - i * 25 );
analogWrite( led2, i * 25 );
delay( 250 );
}
digitalWrite( led1, LOW );
digitalWrite( led2, HIGH );
delay( 250 );
}
void loop() {
lightMe( PIN_BLINK_LED_RED, PIN_BLINK_LED_GREEN);
lightMe( PIN_BLINK_LED_GREEN, PIN_BLINK_LED_BLUE);
lightMe( PIN_BLINK_LED_BLUE, PIN_BLINK_LED_RED);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment