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(cnt) & ~_BV(7-cnt);
- } else {
- cnt %= 4;
- PORTA = PORTA | _BV(cnt+4) | _BV(3-cnt);
- }
- }
- int main(void) {
- DDRA = 0xff;
- PORTA = 0xff;
- uint8_t cnt = 0;
- while (1) {
- blink(cnt);
- cnt = (cnt + 1) % 8;
- // _delay_ms(325);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment