Ups, sorry. Ist ein Attiny24.
Hier der aktuelle Code:
Code:#include <avr/io.h> #include <avr/interrupt.h> ISR(INT0_vect) { static int reading; static int rc_value; if(reading == 0) { TCNT0 = 0; reading = 1; } else { rc_value = TCNT0; TCNT0 = 0; reading = 0; if(rc_value > 128) { PORTA = (0<<PA2); } else { PORTA = (1<<PA2); } } } int main(void) { DDRA = 0xFF; PORTA = 0xFF; DDRB = 0x00; TCCR0B = (1<<CS01); MCUCR = (1<<ISC00); sei(); while(1) { } }
Lesezeichen