My Arduino time library is imported, and yet it is not recognizing any time functions. My code is
#include "time.h"
void setup() {
time_t t = now();
hour(t);
}
void loop() {
// put your main code here, to run repeatedly:
}
It is giving me an "error line 4 'now' was not declared in this scope time_t t = now();"
If anyone knows how to fix this, help would be greatly appreciated!
Have you first installed the library in the Library Manager? Second, to get the actual time, you need to have an external timekeeping source like GPS, the internet or RTC modules etc.
The include file is now TImeLib.h instead of the older Time.h, because operating systems such as Windows cannot differentiate between the library's TIme.h and the standard c library time.h.