Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <avr/io.h>
- #include <util/delay.h>
- #define F_CPU 8000000
- int main()
- {
- DDRC = 0xFF;
- DDRA = 0x00;
- PORTA = 0xFF;
- int delay = 50;
- while(1)
- {
- if (!(PINA&_BV(7)))
- {
- PORTC = 0b00001100;
- _delay_ms(delay);
- PORTC = 0b00000110;
- _delay_ms(delay);
- PORTC = 0b00000011;
- _delay_ms(delay);
- PORTC = 0b00001001;
- _delay_ms(delay);
- }
- else if (!(PINA&_BV(6)))
- {
- PORTC = 0b00001001;
- _delay_ms(delay);
- PORTC = 0b00000011;
- _delay_ms(delay);
- PORTC = 0b00000110;
- _delay_ms(delay);
- PORTC = 0b00001100;
- _delay_ms(delay);
- }
- else if (!(PINA&_BV(5))) { delay += 10; _delay_ms(200); }
- else if (!(PINA&_BV(4))) { if (delay > 50) delay -= 10; _delay_ms(200); }
- else PORTC = 0x00;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement