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