#define F_CPU 16000000L
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
DDRB |= 0x0F; // xxxx1111
PORTB = 0x01;
while (1)
{
while (PORTB != 0x08) {
_delay_ms(500);
PORTB = PORTB << 1;
}
while (PORTB != 0x01) {
_delay_ms(500);
PORTB = PORTB >> 1;
}
}
}
Easy
Top comments (0)