need help on how to send new data


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2008
    Posts
    60

    Default need help on how to send new data

    Hello everyone,

    I have a project where I read temperature and send it to the pc. I have a app that takes the data and displays it. What I need to do is only send new data in other words if the temperature changes. as it is right now I send the temp. reading every 10 seconds. I think it would be better if I only sent the data when it changed. some psudo code would really be a big help. It seems simple, but I can't seem to wrap my head around it. Thanks.
    Regards
    CharlieM
    Using PBP3
    MCSPX

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,521


    Did you find this post helpful? Yes | No

    Default Re: need help on how to send new data

    Something like this perhaps.
    Code:
    Main:
      GOSUB GetCurrentTemperature
      If CurrentTemperature <> PreviouslySentValue THEN   ' Compare new value to old measurment.
        GOSUB SendNewData
      ENDIF
    Goto Main
    
    SendNewData:
      HSEROUT..... or whatever
      PreviouslySentValue = CurrentTemperature   ' Store value for comparison next sample
    RETURN
    On the other hand, it might be good to send occasionally even if the temperature doesn't change. That way you get kind of heartbeat from the transmitter so that the receiver knows its alive.

    /Henrik.

  3. #3
    Join Date
    Nov 2008
    Posts
    60


    Did you find this post helpful? Yes | No

    Default Re: need help on how to send new data

    Thanks Henrik,

    I will give it a try.
    Regards
    CharlieM
    Using PBP3
    MCSPX

Members who have read this thread : 1

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