diff --git a/src/gympal.c b/src/gympal.c index 4025db6..a0d766b 100644 --- a/src/gympal.c +++ b/src/gympal.c @@ -1,15 +1,19 @@ #include #include +void updatePin12(uint8_t status) { + PORTB = status << PORTB4; +} + int main() { // Pin 12 == Port B4, aka 4th bit on the B register. // Set pin 12 as output. DDRB = 1 << PORTB4; - // Set pin 12 as HIGH. - PORTB = 1 << PORTB4; - // Delay for 1 second. - _delay_ms(1000.0); - // Set pin 12 as LOW. - PORTB = 0 << PORTB4; + uint8_t ledOn = 1; + while (1) { + updatePin12(ledOn); + ledOn = !ledOn; + _delay_ms(1000.0); + } return 0; } \ No newline at end of file