Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/io.h>
- #include <util/delay.h>
- #include <avr/io.h>
- #include <avr/pgmspace.h>
- #include <util/delay.h>
- #include <util/crc16.h>
- #include <stdio.h>
- #include <stdbool.h>
- int main (void)
- {
- DDRB = 0xFF;
- DDRC = 0xFF;
- DDRD = 0xFF;
- int i = 0;
- bool c = 0;
- while(1)
- {
- switch(c)
- {
- case 0:
- PORTB |= 1 << i;
- // PORTD |= 1 << i;
- break;
- case 1:
- PORTC |= 1 << i;
- break;
- }
- _delay_ms(4000);
- if( i == 8 )
- {
- c = !c;
- i = -1;
- }
- ++i;
- PORTD = 0b00000000;
- PORTB = 0b00000000;
- PORTC = 0b00000000;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement