24 lines
645 B
C
24 lines
645 B
C
#include <avr/io.h>
|
|
#include <util/delay.h>
|
|
|
|
// The main function: our program entry point
|
|
int main(void) {
|
|
// Set PB5 as output. DDRB is the data direction register for port B.
|
|
// (1 << PB5) shifts 1 over by PB5 bits creating a bitmask.
|
|
DDRB |= (1 << PB5);
|
|
int delay = 100;
|
|
|
|
// Infinite loop to blink the LED
|
|
while (1) {
|
|
// Set PB5 high: LED ON
|
|
PORTB |= (1 << PB5);
|
|
_delay_ms(delay); // Delay 1000 milliseconds (1 second)
|
|
|
|
// Clear PB5: LED OFF
|
|
PORTB &= ~(1 << PB5);
|
|
_delay_ms(delay); // Delay 1000 milliseconds (1 second)
|
|
}
|
|
|
|
return 0; // Though this line is never reached because of the infinite loop
|
|
}
|