Get unixtime of value on feather / arduino

Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Locked
mattxbart
 
Posts: 8
Joined: Tue Dec 04, 2012 5:59 pm

Get unixtime of value on feather / arduino

Post by mattxbart »

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

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

// 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

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”