How to add a basic timer

novolts

Senior Member
Hi Guys
Re my previous post of 20-05-16 I read up on time as advised by westaust55
I altered the code to include a 10 second timer I chose 10 seconds as a starting point
I intend to increase the timer to switch off after 45 minutes even if the temperature is not reached
I would appreciate the comments of forum members on the code
thanks
novolts

#Picaxe 14M2

Symbol BoilerOn = PINC.2
Symbol temperature = b1
Symbol tempWanted = b2

Symbol POT_MIN = 55
Symbol POT_MAX = 65
readtemp C.4, temperature

start:

if BoilerOn=0 then
goto start
else
goto main
endif

main:

time =0

do

ReadTemp C.4, temperature

ReadAdc C.0, tempWanted

tempWanted = POT_MAX - POT_MIN * tempWanted / 255 + POT_MIN

If tempWanted >= temperature Then
High B.5
End If

If temperature>=tempWanted Then
Low B.5
goto start
Endif
loop until time>=10:Low B.5
goto start
 
Last edited:
Top