File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ """
2+ adafruitio_17_time.py
3+ ====================================
4+ Don't have a RTC handy and need
5+ accurate time measurements?
6+
7+ Let Adafruit IO serve real-time values!
8+
9+ Author: Brent Rubell
10+ """
11+ # Import Adafruit IO REST client.
12+ from Adafruit_IO import Client , Feed , Data , RequestError
13+
14+ # Set to your Adafruit IO key.
15+ # Remember, your key is a secret,
16+ # so make sure not to publish it when you publish this code!
17+ ADAFRUIT_IO_KEY = 'YOUR_AIO_KEY'
18+
19+ # Set to your Adafruit IO username.
20+ # (go to https://accounts.adafruit.com to find your username)
21+ ADAFRUIT_IO_USERNAME = 'YOUR_AIO_USERNAME'
22+
23+ # Create an instance of the REST client.
24+ aio = Client (ADAFRUIT_IO_USERNAME , ADAFRUIT_IO_KEY )
25+
26+ print ('---Adafruit IO REST API Time Helpers---' )
27+
28+ print ('Seconds: aio.receive_time(seconds)' )
29+ secs_val = aio .receive_time ('seconds' )
30+ print ('\t ' + secs_val )
31+
32+ print ('Milliseconds: aio.receive_time(millis)' )
33+ ms_val = aio .receive_time ('millis' )
34+ print ('\t ' + ms_val )
35+
36+ print ('ISO-8601: aio.receive_time(ISO-8601)' )
37+ iso_val = aio .receive_time ('ISO-8601' )
38+ print ('\t ' + iso_val )
You can’t perform that action at this time.
0 commit comments