Skip to content

Instantly share code, notes, and snippets.

@Servuc
Created November 20, 2020 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Servuc/d6881ff1705f8c86cc3c3b09327ad069 to your computer and use it in GitHub Desktop.
Save Servuc/d6881ff1705f8c86cc3c3b09327ad069 to your computer and use it in GitHub Desktop.
#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