Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(void)
- {
- // DDRC = 0xFF; //Nakes PORTC as Output
- DDRC = 0b11111000; // set PC0,PC1,PC2 to input
- PORTC = 0b00000111; // set PC0,PC1,PC2 to high
- while(1) //infinite loop
- {
- if (bit_is_clear(PINC,2)) //if button on PC2 is pressed
- {
- while(bit_is_set(PINC,1))
- {
- PORTC |= _BV(PC5); //turn on
- PORTC |= _BV(PC4); //turn on
- _delay_ms(250); //0.5 second delay
- PORTC &= ~_BV(PC4); //turn off
- _delay_ms(250); //0.5 second delay
- PORTC |= _BV(PC4); //turn on
- _delay_ms(250); //0.5 second delay
- PORTC &= ~_BV(PC4); //turn off
- _delay_ms(250); //0.5 second delay
- PORTC |= _BV(PC4); //turn on
- _delay_ms(250); //0.5 second delay
- PORTC &= ~_BV(PC4); //turn off
- _delay_ms(250); //0.5 second delay
- PORTC |= _BV(PC4); //turn on
- _delay_ms(250); //0.5 second delay
- PORTC &= ~_BV(PC4); //turn off
- _delay_ms(250); //0.5 second delay
- PORTC |= _BV(PC4); //turn on
- _delay_ms(250); //0.5 second delay
- PORTC &= ~_BV(PC4); //turn off
- PORTC |= _BV(PC3); //turn on
- }
- }
- PORTC &= ~_BV(PC3); //turn off
- PORTC &= ~_BV(PC4); //turn off
- PORTC &= ~_BV(PC5); //turn off
- // num = random(4);
- _delay_ms(10); //0.5 second delay
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement