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