#define BTN (1 << 1) #define LED_1 (1 << 2) #define LED_2 (1 << 3) #define LED_3 (1 << 4) #define PIN_LEDS (LED_1 | LED_2 | LED_3) void setup() { // Set up our serial monitor Serial.begin(9600); // Set our LEDs as output DDRB |= PIN_LEDS; // Set our BTN as input DDRB &= BTN; // Set our button as internal pullup PORTB |= BTN; } void loop() { int val = analogRead(A0); Serial.println(val); if(!(PINB & BTN)) { PORTB |= LED_1; delay(val); PORTB |= LED_2; delay(val); PORTB |= LED_3; delay(val); PORTB &= ~LED_3; delay(val); PORTB &= ~LED_2; delay(val); PORTB &= ~LED_1; delay(val); } else { PINB &= ~PIN_LEDS; } }