0

How do you pull Data from Feed and use as Var in loop?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

How do you pull Data from Feed and use as Var in loop?

by dsblock19 on Sun Sep 01, 2019 3:03 am

I'm following the subscribe code example and supplementing it with info from io docs here: https://io.adafruit.com/api/docs/mqtt.html#using-the-get-topic.

I'm trying to get the last data from a feed then use it as a variable for comparison in an if function.

That part of code is:
Code: Select all | TOGGLE FULL SIZE
    io.run();
    unsigned int SW = hxweight->get();
    //Send Start Weight
    Serial.print("sending SW-> ");
    Serial.println(SW);
    startweight->save(SW);


IT just always sends a 1.
It's a long code so let me know if I need to post more. My pre-setup and setup is exactly like the example but multiple feeds.

dsblock19
 
Posts: 7
Joined: Tue Mar 19, 2019 5:57 pm

Re: How do you pull Data from Feed and use as Var in loop?

by brubell on Tue Sep 03, 2019 1:55 pm

Could you please post your complete code?

brubell
 
Posts: 496
Joined: Fri Jul 17, 2015 10:33 pm

Please be positive and constructive with your questions and comments.