sysprog-basic/blink/main.c

33 lines
578 B
C

#define F_CPU 16000000UL
#define __AVR_ATmega328P__
#include <avr/io.h>
#include <util/delay.h>
int main(void) {
DDRB = 0xff;
while (1) {
// green
PORTB |= (1 << PORTB5);
_delay_ms(500);
PORTB &= ~(1 << PORTB5);
// yellow
PORTB |= (1 << PORTB4);
_delay_ms(500);
PORTB &= ~(1 << PORTB4);
// red
PORTB |= (1 << PORTB3);
_delay_ms(500);
PORTB &= ~(1 << PORTB3);
// red and yellow
PORTB |= (1 << PORTB3);
PORTB |= (1 << PORTB4);
_delay_ms(500);
PORTB &= ~(1 << PORTB3);
PORTB &= ~(1 << PORTB4);
}
}