Hallo Chris!
Hier der Schaltplan mit Transistor statt Spannungsteiler:
Externes Bild anzeigen
Und hier das abgeänderte Programm:
mfgCode:$regfile = "attiny13.dat" $crystal = 9600000 $hwstack = 32 $swstack = 5 $framesize = 20 Const Half_light = 40 Const Full_light = 255 'PWM-Ausgang Pwm_out Alias Portb.0 Config Portb.0 = Output 'Bremslicht Eingang Break_light_in Alias Pinb.4 Config Pinb.4 = Input Portb.4 = 1 'Pullup 'Timer0 als PWM: 9600000 / 64 / 256 / 2 = 292,9 Hz Config Timer0 = Pwm , Compare A Pwm = Clear Down , Prescale = 64 Pwm0a = Half_light Do If Break_light_in = 0 Then Pwm0a = Full_light Waitms 100 Pwm0a = Half_light Waitms 100 Else Pwm0a = Half_light End If Loop End
Gerold
:-)







Zitieren

Lesezeichen