Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define F_CPU 7372800UL
- #include <avr/io.h>
- #include <util/delay.h>
- void blink(uint8_t cnt) {
- if (cnt <= 3) {
- PORTA = PORTA & ~_BV(4+cnt) & ~_BV(3-cnt);
- } else {
- cnt = cnt % 4;
- PORTA = PORTA | _BV(4+cnt) | _BV(3-cnt);
- }
- }
- int main() {
- DDRA = 0xff;
- PORTA = 0xff;
- uint8_t cnt = 0;
- while (1) {
- blink(cnt);
- cnt = (cnt+1) % 8;
- _delay_ms(200);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement