[SOLVED] Keep getting the error message 'setTime' was not declared in this scope

Hello everyone! I'm attempting to recreate a project from Instructables. I've done a few other projects with the ATtiny85 and Arduino Uno R3 but am having some serious issues with this one. I have everything wired up but can't even test it till I can upload the sketch. This is the error message I keep on getting.

GranfatherClok.ino: In function 'void setup()':

GranfatherClok:7: error: 'setTime' was not declared in this scope

   setTime(8,59,10,14,10,2013);

                             ^

GranfatherClok.ino: In function 'void loop()':

GranfatherClok:18: error: 'minute' was not declared in this scope

 if (minute()==15&&second()==00||minute()==30&&second()==00||minute()==45&&second()==00||minute()==00&&second()==00||butt==HIGH)

            ^

GranfatherClok:18: error: 'second' was not declared in this scope

 if (minute()==15&&second()==00||minute()==30&&second()==00||minute()==45&&second()==00||minute()==00&&second()==00||butt==HIGH)

                          ^

GranfatherClok:20: error: 'hour' was not declared in this scope

     for (int a=hour();a!=0;a--)

                     ^

exit status 1
'setTime' was not declared in this scope


Arduino: 1.8.5 (Windows 8.1), Board: "ATtiny25/45/85, ATtiny85, Internal 1 MHz"

Here is the code I'm trying to use compile

#include <Time.h>
  
  int butt;

void setup() {
  
  setTime(8,59,10,14,10,2013);
  
  pinMode(0, OUTPUT);
  pinMode(4, INPUT);
  
  }

void loop() {
  
butt = digitalRead(4);

if (minute()==15&&second()==00||minute()==30&&second()==00||minute()==45&&second()==00||minute()==00&&second()==00||butt==HIGH)
  {
    for (int a=hour();a!=0;a--)
    {
      digitalWrite(0, HIGH);
      delay(250);
      digitalWrite(0, LOW);
      delay(250);
    }
    
    for (int b=minute()/15;b>0;b--)
    {
      digitalWrite(0, HIGH);
      delay(250);
      digitalWrite(0, LOW);
      delay(250);
    }
     
  }
  
}

Here is a link to the original project

This was supposed to be an easy stepping stone project. I have ADHD and don't feel the passage of time correctly. This would be a non-disruptive way for me to keep track.

Eventually, I would like to make something that has a few different modes (vibrate every 5, 10, or 20 min.) I would like to eventually run it off a tiny lipo but for now, it's a CR2032. I think the logical next step for this project would be to make this super low power. I think that means it has to go into deep sleep mode and use the WDT to wake it up. // I found some other projects I think I can cannibalize some code form

I thought this project would be a step in the right direction. If I can just get this working correctly, as is, for now, I'd be super happy and greatly appreciative. I've tried searching for a solution on my own but have so far found nothing.

Also if anyone has any suggestions on the next thing I should build/learn to get me further along on my final project that would be amazing.

The problem is that, since the time that Instructable was written, a file named time.h was added to the compiler toolchain. On a filename case insensitive operating system like Windows this file gets included instead of the intended file from the Time library. This problem is known to the Time library author/maintainer and so they added an alternate header file named TimeLib.h. So, as long as you have a recent version of the Time library installed, you can fix the error by changing this line:

#include <Time.h>

to:

#include <TimeLib.h>
1 Like

Thank you so much for the quick and helpful reply! That did the trick. Now if I could only get the wiring right everything will be gravy!

I'm glad to hear the code is now compiling. I have added a comment to the Instructables page so that hopefully others won't have the same problem.