Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Button*/
- #include <avr/io.h>
- #include <util/delay.h>
- #define F_CPU 16000000UL
- int main(void)
- {
- DDRD &= ~_BV(DDD2); //Set as input
- DDRB |= _BV(DDB5); // set as output
- PORTB= 0x00;
- while(1)
- {
- if(bit_is_set(PIND,PIND2))
- {
- PORTB|= _BV(PORTB5); // to set buzzer
- }
- else
- {
- PORTB &= ~_BV(PORTB5);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement