35 lines
614 B
C
35 lines
614 B
C
#define F_CPU 16000000UL
|
|
#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);
|
|
}
|
|
}
|