Offline
Newbie
Karma: 0
Posts: 1
|
 |
« on: August 11, 2012, 09:53:34 am » |
Hi, this is my first step into Arduino and micro controllers. I do have C# experience, but the Arduino code is kind of throwing me of. Anyway, I want my arduino to trigger blink at a specific time. Here is my code: #include <Time.h> #include <TimeAlarms.h> int led = 2;
void setup() { Serial.begin(9600); setTime(9,15,0,8,11,12); // set time to Saturday 8:29:00am Jan 1 2011 Alarm.alarmRepeat(5, 45, 0, MorningAlarm); pinMode(led, OUTPUT);
}
void MorningAlarm() { Serial.println("Wake UP"); digitalWrite (led, HIGH); delay(1000); digitalWrite (led, LOW); delay(1000); }
I get this error message: C:\Users\John\Desktop\arduino-1.0.1\libraries\TimeAlarms\TimeAlarms.cpp: In member function 'void TimeAlarmsClass::delay(long unsigned int)': C:\Users\John\Desktop\arduino-1.0.1\libraries\TimeAlarms\TimeAlarms.cpp:256: error: 'millis' was not declared in this scope What is the problem? I installed the Time library and all the libraries in it. Thanks for helping me out.
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 311
Posts: 35470
Seattle, WA USA
|
 |
« Reply #1 on: August 11, 2012, 09:58:47 am » |
Let's start with the basics. What version of the IDE are you using? 1.0.1 has a fatal flaw, in my opinion, in which missing include files are not fatal errors.
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 5
|
 |
« Reply #2 on: August 13, 2012, 03:13:59 am » |
Hi, where does one find the TimeAlarms library? Been searching the arduino site but no luck. Many thanks in advance!
|
|
|
|
|
Logged
|
|
|
|
|
Seattle, WA USA
Offline
Brattain Member
Karma: 311
Posts: 35470
Seattle, WA USA
|
 |
« Reply #3 on: August 13, 2012, 03:58:29 am » |
Hi, where does one find the TimeAlarms library? Been searching the arduino site but no luck. What have you been searching for? http://arduino.cc/playground/Code/Time
|
|
|
|
|
Logged
|
|
|
|
|
Grand Blanc, MI, USA
Offline
Edison Member
Karma: 43
Posts: 2491
"We're a proud service of the Lost Electricity Reclamation Agency"
|
 |
« Reply #4 on: August 13, 2012, 05:38:34 am » |
Oddly, while the Time library was updated for Arduino 1.0 and later, TimeAlarms was not. Replace the TimeAlarms.cpp file with the one attached.
Your sketch also needs the loop() function defined. Every Arduino sketch needs setup() and loop() defined, even if they are empty.
|
|
|
|
|
Logged
|
|
|
|
|
Pensacola FL
Offline
Newbie
Karma: 0
Posts: 4
I've forgotten more than I care to remember!
|
 |
« Reply #5 on: August 19, 2012, 07:35:50 pm » |
I've tried the file that Jack Christensen posted, but I still get the following: C:\arduino-1.0.1\libraries\TimeAlarms\TimeAlarms.cpp: In member function 'void TimeAlarmsClass::delay(long unsigned int)': C:\arduino-1.0.1\libraries\TimeAlarms\TimeAlarms.cpp:256: error: 'millis' was not declared in this scope. I'm using the stock unchanged example "TimeAlarmExample". I'm running 1.0.1. Getting really frustrated. 
|
|
|
|
|
Logged
|
|
|
|
|
Grand Blanc, MI, USA
Offline
Edison Member
Karma: 43
Posts: 2491
"We're a proud service of the Lost Electricity Reclamation Agency"
|
 |
« Reply #6 on: August 19, 2012, 08:05:33 pm » |
I just double-checked using the following procedure, also using Arduino 1.0.1. 1. Shut down the IDE. 2. Delete Time, TimeAlarms, DS1307RTC libraries. 3. Download Time.zip from http://arduino.cc/playground/Code/Time and unzip. 4. Start IDE, compile "TimeAlarmExample" ... duplicates the error messages as above. 5. Shut down IDE. 6. Download TimeAlarms.cpp from the post above, replace the existing file in the library with it. 7. Start IDE, compile "TimeAlarmExample" ... compiles OK. I know that no one likes to hear "NTF" but if I can't duplicate the problem...
|
|
|
|
|
Logged
|
|
|
|
|
Pensacola FL
Offline
Newbie
Karma: 0
Posts: 4
I've forgotten more than I care to remember!
|
 |
« Reply #7 on: August 19, 2012, 08:24:33 pm » |
Jack, I'm at a loss. I took line 256 from TimeAlarms.cpp and put it in a blank sketch with the setup and void loop, and it compiles fine? I'll have to try it on my laptop and see if I get the same error. I have started and restarted, deleted and reinstalled on desktop cpu. and can't get rid of the error. Mark
|
|
|
|
|
Logged
|
|
|
|
|
Grand Blanc, MI, USA
Offline
Edison Member
Karma: 43
Posts: 2491
"We're a proud service of the Lost Electricity Reclamation Agency"
|
 |
« Reply #8 on: August 19, 2012, 08:31:48 pm » |
I took line 256 from TimeAlarms.cpp and put it in a blank sketch with the setup and void loop, and it compiles fine?
Huh? What's on that line, and why would you do that? Line 256 in TimeAlarms.cpp is a blank line in my copy. Did you follow the procedure in my previous post, verbatim? Edit: Oh sorry, line 256 is blank in my modified version, but not in the original. Anyway, I don't see where doing that is appropriate, so same answer, follow the procedure above. Delete the libraries, download an install fresh copies, then replace the TimeAlarms.cpp file with my modified version.
|
|
|
|
« Last Edit: August 19, 2012, 08:34:26 pm by Jack Christensen »
|
Logged
|
|
|
|
|
Pensacola FL
Offline
Newbie
Karma: 0
Posts: 4
I've forgotten more than I care to remember!
|
 |
« Reply #9 on: August 19, 2012, 09:06:01 pm » |
Hey Jack, Tried it on the laptop; same thing. The reason that I moved the line to a basic sketch with nothing else was to verify that millis() is defined. I'm going to do a complete new install of the ide and libs.
Mark
|
|
|
|
|
Logged
|
|
|
|
|
Grand Blanc, MI, USA
Offline
Edison Member
Karma: 43
Posts: 2491
"We're a proud service of the Lost Electricity Reclamation Agency"
|
 |
« Reply #10 on: August 19, 2012, 09:29:32 pm » |
Ah, ok, so millis() works in other circumstances. Any chance that the new version of TimeAlarms.cpp is not getting saved in the right place? If line 256 was not blank, then that's not my updated copy. There could be other things I suppose, but those symptoms are consistent with the original TimeAlarms.cpp from the zip file being used.
|
|
|
|
|
Logged
|
|
|
|
|
Pensacola FL
Offline
Newbie
Karma: 0
Posts: 4
I've forgotten more than I care to remember!
|
 |
« Reply #11 on: August 19, 2012, 09:58:49 pm » |
Hi Jack, Did a complete install of the ide and the time lib, along with the updated file from you. It now works. Not sure what was wrong (probably me....I mean most likely me. We know it couldn't be Windows). Now I need to load my other libs one at a time and make sure that it doesn't corrupt anything.
Thanks, Mark
|
|
|
|
|
Logged
|
|
|
|
|
Grand Blanc, MI, USA
Offline
Edison Member
Karma: 43
Posts: 2491
"We're a proud service of the Lost Electricity Reclamation Agency"
|
 |
« Reply #12 on: August 19, 2012, 10:01:42 pm » |
Hey Mark, Cool! Yeah with Windoze involved we'll cut ya some slack  Have fun ... jc
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Newbie
Karma: 0
Posts: 2
|
 |
« Reply #13 on: November 27, 2012, 09:33:06 am » |
can you post/share the updated file? I have the same issue re install did not work for me, tested on 2 machines.
thanks
Jasper
|
|
|
|
|
Logged
|
|
|
|
|
Grand Blanc, MI, USA
Offline
Edison Member
Karma: 43
Posts: 2491
"We're a proud service of the Lost Electricity Reclamation Agency"
|
 |
« Reply #14 on: November 27, 2012, 10:03:14 am » |
can you post/share the updated file? I have the same issue re install did not work for me, tested on 2 machines.
thanks
Jasper
Look up ... it's still there: http://arduino.cc/forum/index.php/topic,118132.msg890823.html#msg890823
|
|
|
|
|
Logged
|
|
|
|
|
|