#include <Time.h>

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.

This is probably a dumb error, but I am lost.

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

 if(minute() % 6 = 0)

You can't assign the value 0 to the result of the modulo operator.

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"

So, what Arduino are you compiling for?

Have you tried changing the #include statement to include TimeLib.h, instead? Have you upgraded your installation of the Time library?

compiling for WeMos D1R2.

just installed the time library two days ago.

TimeLib.h seems to have solved the problem. Somehow I missed this.

Thanks.

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

#include <TimeLib.h>

void setup() {
  Serial.begin(115200);
  time_t t = now();
  
  //Serial.println(hour((time_t)now()));
  //Serial.println(minute((time_t)now()));
  Serial.print("\n\n");
  Serial.println(minute(t));
  Serial.println(second(t));
  Serial.println(t);

}

it prints
0
0
0
the commented lines also return the same value, I tested it just to I don't have to declare variables

I'll look for a way to solve it