chakib 1 Posted April 28, 2015 Share Posted April 28, 2015 Hello, I'm looking for an example to get the actual date with Energia CC3200 WiFi Lunchpad. Any idea? Regards. Quote Link to post Share on other sites
chakib 1 Posted April 28, 2015 Author Share Posted April 28, 2015 I found the solution here: https://github.com/elpaso/rtclib I used the SoftRTC.ino example to print the actual date and time. Regards. Quote Link to post Share on other sites
chakib 1 Posted April 28, 2015 Author Share Posted April 28, 2015 Of course, you have to add the RTClib library to your Energia and restart. bluehash 1 Quote Link to post Share on other sites
chakib 1 Posted April 28, 2015 Author Share Posted April 28, 2015 The code source: #include <Wire.h> #include <RTClib.h> RTC_Millis RTC; void setup() { // put your setup code here, to run once: Serial.begin(115200); // following line sets the RTC to the date & time this sketch was compiled RTC.begin(DateTime(__DATE__, __TIME__)); } void loop() { // put your main code here, to run repeatedly: DateTime now = RTC.now(); Serial.print(now.year(), DEC); Serial.print('/'); Serial.print(now.month(), DEC); Serial.print('/'); Serial.print(now.day(), DEC); Serial.print(' '); Serial.print(now.hour(), DEC); Serial.print(':'); Serial.print(now.minute(), DEC); Serial.print(':'); Serial.print(now.second(), DEC); Serial.println(); delay(3000); } Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.