Hi Jessey,
I noticed in your 1st subroutine "Select_A_Sensor_To_Read:" you are swapping your variables before the gosub to "Check_Temperature:" . What happens if you read the temperature first
right before the swap statement. The last sensor reading will now be in the temp variable. It can now be stored in Radiator_Temp or Block_temp. The way you have it now it reads the temperature to temp and exits the subroutine.
Try this
Add a new variable Old_temp
If I = 0 Then''''''''''''''''''''
Sensor_Select = Radiator_Sensor' This is a little convoluted to say the
GOSUB Check_Temperature ' it should work then the program switches
SWAP Old_temp, Radiator_temp ' least but it works, how and why I have no
Radiator_temp = temp ' idea. If I uncomment the commented out code
Endif ' sensors around i.e. instead of reading the
' Radiator_Sensor on pin 15 it then reads
If I = 1 Then ' the sensor on 33 even though it's declared
Sensor_Select = Block_Sensor ' on pin 15 and vice versa for the
GOSUB Check_Temperature ' it should work then the program switches
SWAP Old_temp, Block_temp ' DS1820 Block_Sensor. So it switches the
Block_temp = temp ' two sensors, very confusing! It must be in
Endif
Return''''''''''''''''''''''''''''''
Bookmarks