I made a vivarium controller some months ago which is working as planned.
It controls the light on/off at set times and controls the heat lamp, increasing the temperature in the morning, holding a set temperature all day and decreasing at night.
With trial and error I found that checking the temperature every three minutes allowed the heat lamp enough time to heat up/cool down to a point where it needed to be either on or off. Anything less and the relays would sometimes flash on and off if the temperature reading was hovering around the trigger point.
The code below is the section that checks the time every three minutes. It works fine but I would like to know if and how it could be shortened?
It controls the light on/off at set times and controls the heat lamp, increasing the temperature in the morning, holding a set temperature all day and decreasing at night.
With trial and error I found that checking the temperature every three minutes allowed the heat lamp enough time to heat up/cool down to a point where it needed to be either on or off. Anything less and the relays would sometimes flash on and off if the temperature reading was hovering around the trigger point.
The code below is the section that checks the time every three minutes. It works fine but I would like to know if and how it could be shortened?
Code:
IF MINS=1 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=4 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=7 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=16 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=19 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=22 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=25 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=34 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=37 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=40 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=49 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=52 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=55 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=64 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=67 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=70 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=73 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=82 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=85 AND SECONDS <2 THEN GOTO TEMPTEST
IF MINS=88 AND SECONDS <2 THEN GOTO TEMPTEST