SparkyDave
Member
Hi Everyone!
I wrote some code last night to make a intermittant controller for my car windscreen wipers. I'm sure i'm close with it but when simmulating it, the timing doesnt seem to be correct.
The concept:
My car already has an intermittant setting for the windscreen wipers however it is extremely old school. I'm talking, a motor with a cam operating a switch, enclosed in a little box under the dash. Being that it is old, the motor squeels when in use and drives me crazy! Rather than replace the motor I thought it would be a perfect time to build my first PICAXE project. (i am working on another major project but that is still in the development phase, working out how to build the hardware)
The plan is to remove the motor driven intermittant controller and use the PICAXE to control the timing, which can then be adjusted on the fly.
INPUTS= signal from intermittant position of wiper switch, signal from washer switch
OUTPUTS= intermittant FET, washer FET
My idea was to set it up so that if the wipers were on intermittant, the washer control will adjust the delay time instead of actually wash. This would be done in increments, say 5 settings, before resetting to the first delay period again. If the wipers are in any other mode (low, or high), then the wash control would simply wash.
This is what I have so far, and it works except that the delay adjustment. It didnt seem to be pausing correctly on the intermittant run section. Although it was late last night after a 12 hour work day so maybe I just need a fresh try at it! I also made a couple of changes before going to bed which i didnt test so it might be a bit wrong there....i have also just made a few inclusions while doing this post and i dont have the programming editor here at work to test it
would love a little assistance if that is ok.
Cheers guys,
Dave
PS-I'm sorry about the notes being cluttered with the code, I dont know how to fix that on the forum... it isnt like that when I type it...
I wrote some code last night to make a intermittant controller for my car windscreen wipers. I'm sure i'm close with it but when simmulating it, the timing doesnt seem to be correct.
The concept:
My car already has an intermittant setting for the windscreen wipers however it is extremely old school. I'm talking, a motor with a cam operating a switch, enclosed in a little box under the dash. Being that it is old, the motor squeels when in use and drives me crazy! Rather than replace the motor I thought it would be a perfect time to build my first PICAXE project. (i am working on another major project but that is still in the development phase, working out how to build the hardware)
The plan is to remove the motor driven intermittant controller and use the PICAXE to control the timing, which can then be adjusted on the fly.
INPUTS= signal from intermittant position of wiper switch, signal from washer switch
OUTPUTS= intermittant FET, washer FET
My idea was to set it up so that if the wipers were on intermittant, the washer control will adjust the delay time instead of actually wash. This would be done in increments, say 5 settings, before resetting to the first delay period again. If the wipers are in any other mode (low, or high), then the wash control would simply wash.
This is what I have so far, and it works except that the delay adjustment. It didnt seem to be pausing correctly on the intermittant run section. Although it was late last night after a 12 hour work day so maybe I just need a fresh try at it! I also made a couple of changes before going to bed which i didnt test so it might be a bit wrong there....i have also just made a few inclusions while doing this post and i dont have the programming editor here at work to test it
Code:
'Windscreen wiper/washer control
'18/05/2011
symbol INTsw = pin3 'set pin 3 as intermittant switch input
symbol WASHsw = pin4 'set pin 4 as washer switch input
symbol INTout = 1 'set pin 1 as intermittant output
symbol WASHout = 2 'set pin 2 as washer output
symbol DELAY = 2000 'set delay symbol as value 2000
symbol DELAYmult = b0 'set variable b0 as delay multiplier
symbol DELAYtime = b1 'set variable b1 as delay time
DELAYmult = 1 'set initial delay multiplier to 1
DELAYtime = 2000 'set initial delay time to 2 seconds
main:
if INTsw = 1 and WASHsw = 1 then ADJint 'adjust delay if int is ON and wash switched
if INTsw = 1 and WASHsw = 0 then INTrun 'simply run in in int mode
if INTsw = 0 and WASHsw = 1 then WASHrun 'simply wash when not in int mode
low WASHout
goto main
ADJint:
DELAYmult = DELAYmult + 2 'increment the delay multiplier for longer delay time
if DELAYmult = 9 then RESETint 'if the multiplier is at max, go and reset
DELAYtime = DELAY * DELAYmult 'create the delay time
goto INTrun
INTrun:
high INTout 'output pulse for int mode
pause 500
low INTout
pause DELAYtime
goto main
WASHrun:
high WASHout 'output to run washer pump
goto main
RESETint:
DELAYmult = DELAYmult - 8 'this will reset DELAYmult back to 1
goto main
would love a little assistance if that is ok.
Cheers guys,
Dave
PS-I'm sorry about the notes being cluttered with the code, I dont know how to fix that on the forum... it isnt like that when I type it...
Last edited: