I am very new to the Arduino programming language and have some sporadic experience with other languages, but overall pretty new to all this.
I am trying to learn how to use the Time library. I have downloaded and imported and included the library. I have successfully used other non standard libraries as well so far.
I am simply trying to Serial.print the current hour (or minute or time etc..). I have reviewed forums and searched google for answers. I have looked at the sketchbook examples and can't figure out what I'm doing wrong. It seems soooo simple to do what I want to do. Its probably so simple that there aren't any examples to be found :
Here's my code:
#include "Time.h"
#include "TimeLib.h"
void setup()
{
Serial.begin(9600);
}
void loop()
{
time_t t = now();
Serial.print(hour());
delay(5000);
}
When I verify this code its fine, and then I upload it to my board. Then when I open the serial monitor, I am expecting to see the current hour but instead I see "0". Again I want to see the current hour. I just can't figure out what I'm doing wrong here.
I really appreciate your time and help.
I really appreciate your time and help.