0

Get unixtime of value on feather / arduino
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Get unixtime of value on feather / arduino

by mattxbart on Thu Jan 17, 2019 2:42 am

Hi,
I've been looking around for an example of how to get the "created" value from a feed on arduino, like the one you see in the io.adafruit.com feed interface. I have a handleMessage function that does the following:

Code: Select all | TOGGLE FULL SIZE
void handleMessage(AdafruitIO_Data *data) {

  Serial.print("received <- ");
  Serial.println(data->value());
  digitalWrite(5, HIGH);       // sets the digital pin 5 on
  delay(1000);                  // waits for a second
  digitalWrite(5, LOW);        // sets the digital pin 5 off
  delay(1000);             

}


I can't figure out how to get the created date (preferably as a unix timestamp) of the message so I can do a date comparison with a RTC or the time feed so I can ignore old messages. Basically I only want to process messages that have been sent within the last minute and ignore everything else so I don't process irrelevant data.

Another way I could do it is only grab messages in the feed within a minute of the current time (by a filter of some sort?) but I couldn't figure out how to do that either. I've seen the REST examples but I'm on an arduino using the AdafruitIO_WiFi lib so I'm having trouble how that is done. My feed setup looks like this:

Code: Select all | TOGGLE FULL SIZE
// set up the feed
AdafruitIO_Feed *myfeed = io.feed("myfeed");


I would think I could somehow filter the feed results to limit them by created date > minute old within the loop.

Thanks for your help and any guidance.

-Matt
mattxbart
 
Posts: 1
Joined: Tue Dec 04, 2012 5:59 pm

Please be positive and constructive with your questions and comments.