sysprog-basic/beep/main.c

22 lines
336 B
C

#define F_CPU 16000000UL
#define __AVR_ATmega328P__
#include <avr/io.h>
int main(void) {
DDRB = 0xff;
DDRD = 0;
PORTD |= (1 << PORTD2) | (1 << PORTD3);
PORTB = 0;
while (1) {
if (!(PIND & (1 << PIND2))) {
PORTB |= (1 << PORTB5);
}
if (!(PIND & (1 << PIND3))) {
PORTB &= ~(1 << PORTB5);
}
}
}