Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unsigned char old = 0;
- unsigned char dat = 0;
- void setup()
- {
- DDRD = 0xFF;
- DDRB = 0xFF;
- DDRC = 0x00;
- PORTD = 0x01;
- PORTB = 0x00;
- }
- void loop()
- {
- if((PINC&0x01) && !old)
- {
- if(!dat)
- {
- if(PORTD < 0x80)
- {
- PORTD <<= 0x01;
- }
- else
- {
- PORTB = 0x01;
- PORTD = 0x00;
- dat = 1;
- }
- }
- else
- {
- if(PORTB < 0x20)
- {
- PORTB <<= 0x01;
- }
- else
- {
- PORTB = 0x00;
- PORTD = 0x01;
- dat = 0;
- }
- }
- }
- old = PINC&0x01;
- delay(20);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement