How do I compare two temperatures


Closed Thread
Results 1 to 5 of 5

Hybrid View

  1. #1
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    I made the display of temperature, but do not know how to check whether increased or decreased, given that temperature is shown in the format xx.xx
    Can you help me with some examples?
    Now let assume that your unformatted temperature reading is contained in a variable named New_Temp, then make available an additional variable (same type) and call it Old_Temp.

    Write a subroutine that you will call all the time you want to check the temperature variation.

    Code:
    Temp_Sub:
    IF New_Temp > Old_Temp Then LCDOUT "up arrow"
    IF New_Temp = Old_Temp Then LCDOUT "             "
    IF New_Temp < Old_Temp Then LCDOUT "Dn arrow"
    Old_Temp = New_Temp
    Return
    ..... and you are in business.

    Cheers

    Al.
    All progress began with an idea

  2. #2
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    You beat me to it.

    I use a similar process for monitoring the temperatures in my Vivariums, and sounding an alarm if they exceed a set range. Basically

    Code:
    IF Temperature >  alarmhigh  then AlarmPin = 1
    IF Temperature <  alarmlow  then AlarmPin = 1
    The variables used are word type so in my code for the thermostat 23.6C would be stored as 236. Likewise a high threshold would be 350 (35.0c)

  3. #3
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    IF Temperature > alarmhigh then AlarmPin = 1
    IF Temperature < alarmlow then AlarmPin = 1
    Malcom, you have a typo in your two lines of code!

    Al.
    All progress began with an idea

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts