Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * blink1.c
- */
- #include <avr/io.h>
- #include <avr/interrupt.h>
- int main(void)
- {
- DDRC|=(<<PC5); //OUT LED
- DDRC|=(<<PC4); //OUT LED
- DDRB &=~(1<<PB1); //IN
- DDRB &=~(1<<PB2); //IN
- while(1)
- {
- if (PORTB &(1<<PB1)==1); //nuspaustas PORTB1 mygtukas
- {
- PORTC |=(1<<PC5); //LED on
- delay_ms(3000); //3s
- PORTC &=~(1<<PC5); //LED off
- }
- }
- if (PORTB &(1<<PB2)==1); //nuspaustas PORTB2 mygtukas
- {
- PORTC |=(1<<PC4); //LED on
- delay_ms(6000); //6s
- PORTC &=~(1<<PC4); //LED off
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement