I have a running sketch that I tried to add some time functions to. In the code lines prior to setup() I have the line
#include <Time.h>
Inside the loop() I added the lines
if(minute() % 6 = 0)
Serial.println(minute());
On compile, I get the error
sketch_A:94: error: 'minute' was not declared in this scope
if(minute() % 6 = 0)
Under the tab Sketch/Include Library the drop down shows that the Time library is installed. The code is being compiled for the WeMos D1R2. I've checked the compatibility of the WeMos and it shows that millis() and the time functions should all work.
I'm guessing you are using Windows.
That OS does not pay attention to the case of letters in filenames.
Some cores (the ESP8266 being one of them) include their own time routines and profile a header file named time.h
The problem is Windows will see time.h the same as Time.h and pick that time.h header file instead of Time.h
To work around the Windows issues with file names, the Time library also includes a header file named TimeLib.h
You can include that file instead of Time.h if using Windows.
Geeze, my bulb is totally dim today. Thanks. That's not the first time I've done that.
BUT, that's not the problem. Even when that is fixed I continue to get the same error. Something is keeping the Time Library from being included correctly (IMHO).
I had previously added the following line of code inside of loop()
int a = hour() ;
and I also got the "not declared in this scope" error for "hour"
bperrybap:
I'm guessing you are using Windows.
That OS does not pay attention to the case of letters in filenames.
Some cores (the ESP8266 being one of them) include their own time routines and profile a header file named time.h
The problem is Windows will see time.h the same as Time.h and pick that time.h header file instead of Time.h
To work around the Windows issues with file names, the Time library also includes a header file named TimeLib.h
You can include that file instead of Time.h if using Windows.
--- bill
Thank you very much, it worked, but now all my time is returning 0. I did