This commit is contained in:
Christoph J. Scherr 2023-10-27 10:52:58 +02:00
parent 4fa8c52157
commit 6515ff4c97
1 changed files with 23 additions and 25 deletions

View File

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