Comfort Automation/ Security System Forums

Full Version: Practical Temp Control Using SCS
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Never been good at maffs Tongue and cannot see the answer for looking...

Trying to get Comfort to turn an output on or off based on the temperature of the SCSSensor and comparision to a counter containing the setpoint.

Obviously the counter can only contain a value of 0-255, no negative numbers.

So how do I work out wether to turn the output on or off, using if statements or subtracting counters?

 
Sorry we missed this question
16 months is still not that bad for an answerBig Grin

This code is a suitable example

Get SensorRegister 8
Subtract Counter001
If LastActionValue <128 Then
    Do IR1Output1
End If

It compares sensor 8 with the value in  counter 1
If <128 (equivalent to > 0)  then it does something
Note that counter values 0 to 255. If a comparison result is negative the value in the counter is > 128
eg
Counter 1 =100
Counter 2 = 200
Counter 1 - Counter 2 gives a value in the counter of 100-200+256 = 156
This is because counters have positive values and dont directly support signed arithmetic

You can add the Else condition if the sensor is less than the counter value