Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/io.h>
- #include <util/delay.h>
- void main() {
- DDRB = 0b00000000;
- PORTB = 0b00000001;
- DDRA = 0b11111111;
- PORTA = 0b00000001;
- int dir = 1;
- int num = 0;
- while (1) {
- if (!(PINB & 0b00000001)) {
- dir *= -1;
- }
- PORTA = 1 << num;
- _delay_ms (100);
- num = (num + 1*dir + 8) % 8;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement