Julian Rogers Home Headlights 2 Home

I was working on this project in 2008 and have just (2015) reviewed the very simple software (it was quite hard to find after all these years) and have noticed that I wasn’t thinking very clearly at the time. (In some ways this is good news as we become used to the idea that we rapidly get stupider as we get older. In this very limited case I seem to have decreased entropy - it won’t last - you can’t buck the second law of thermodynamics!)

This is the program I used:

'h/lights control unit tr7


'out from 555 is '1' when light are off

pause 1000


low 1

if pin3 = 1 then main


high 1

pause 4000

if pin3 = 0 then up

goto main

'h/lights control unit tr7


'out from 555 is '1' when light are off

pause 1000

let b1 = 0     'counter variable


low 1     'lights down

if pin3 = 1 then main  'wait for light on or flash

'routine when lights are on


high 1    'lights up

pause 100

if pin3 = 0 then reset 'lights are still on?

let b1 = b1 + 1   'increment if lights are off

if b1 > 39 then main  'its been 4 sec since lights on

goto up    'keep checking lights are on

reset:    'start again waiting 4 secs

let b1 = 0

goto up

This program simply waits for the lights to go on then puts the lamps up. After 4 seconds it checks again and if the lights are off it puts the lights down then starts again. If you were doing a long flash over 4 seconds long (no sniggering!) then the lights would go down if at the end of the 4 seconds the light happened to be off.

I should have used something like the program below which checks every 100 milli seconds to see if the lights are on. If they are, the 4 second period is reset. I haven’t tried this! It’s often difficult to spot blindingly obvious mistakes so apologies if there are any!

Head lamp controller software