Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/io.h>
- #include <util/delay.h>
- int main (void) {
- DDRA=0xFF;
- DDRB &=(1<<4);
- PORTB |=(1<<4);
- PORTA=0xFF;
- while(1)
- {
- if (!(PINB&(1<<4))) {
- for(int i=0;i<=7;i++){
- PORTA = ~(1<<i);
- _delay_ms(500);
- }
- } else {
- for(int i=7;i>=0;i--){
- PORTA = ~(1<<i);
- _delay_ms(500);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment