Danke für die schnelle Antwort!
Ich habe das jetzt umgschrieben:
Code:
#include <avr/io.h>
#include <stdint.h>
#define F_CPU 3686400UL
#include <util/delay.h>
int main (void)
{ DDRB=0x00; // Port B als Eingang
PORTB=0xff; // Pull-ups auf Port B ein
DDRC=0xff; // Port C als Ausgang
PORTC=0x00; // Alle Pins auf Port C auf low
while (1)
{ while (bit_is_set(PINB, 3))
{ PORTC&=~(1<<PC5);
}
while (bit_is_set(PINB, 3))
{ PORTC|=(1<<PC5);
}
}
return 0;
}
Die Led hängt jetzt an C5 und der Taster an B2
Jetzt leuchtet die Led immer, außer wenn ich auf den Taster drücke, auch wenn ich bit_is_set und bit_is_clear vertausche.
Woran liegt das?
Grüße,
Christoph
Lesezeichen