Pages: [1]   Go Down
Author Topic: Time Libraries - Mac OS X - Examples don't Verify  (Read 467 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,
I can't seem to get the Time Libraries to work - at all. I have googled and searched the forum. Some people forgot to download the libraries but from what I can tell the Time Libraries are real, they're current, and people are somehow getting them to work. I see that some Libraries don't work with 1.0 and later, but I've found some posts which suggest that Time works fine.  

I am using Mac OS X 10.6.8 and I have tried using Arduino IDE at both versions 1.0.1 and 1.0.4.

I have downloaded the library zip files mentioned here: http://playground.arduino.cc/Code/time

Saved both files-

- http://playground.arduino.cc/uploads/Code/Time.zip
- https://bitbucket.org/bjoern/arduino_osc/get/tip.zip

And decompressed them into ~/Arduino/Documents/Libraries/ ... I have also tried using ~/Arduino/Documents/libraries/

~ is my home directory, /Users/blentz/

$ ls -l /Users/blentz/Documents/Arduino/Libraries/
total 0
drwxr-xr-x@  6 blentz  staff  204 Mar 31 14:50 Time
drwxr-xr-x@ 11 blentz  staff  374 Mar 31 14:50 UDPbitewise

Once completed, the Libraries show up in the IDE under Sketch, Import Library, Time and in Sketch, Import Library, UDPbitewise

Finally, the Examples show up in the IDE under File, Examples, Time (etc.)

So.. it seems like the libraries are in the right place and that the Arduino IDE can read them. If I delete them from the Libraries (or libraries ... it doesn't seem to matter) and restart the IDE, then they do disappear.

However, upon trying to Verify any of the examples, it always gives the same error.

File, Examples, Time, Time, Examples, TimeSerial (for example) gives the following error at Verify:

Code:
TimeSerial:24: error: 'time_t' does not name a type
TimeSerial.pde: In function 'void setup()':
TimeSerial:20: error: 'requestSync' was not declared in this scope
TimeSerial:20: error: 'setSyncProvider' was not declared in this scope
TimeSerial.pde: In function 'void loop()':
TimeSerial:29: error: 'timeStatus' was not declared in this scope
TimeSerial:29: error: 'timeNotSet' was not declared in this scope
TimeSerial:31: error: 'timeSet' was not declared in this scope
TimeSerial.pde: In function 'void digitalClockDisplay()':
TimeSerial:39: error: 'hour' was not declared in this scope
TimeSerial:40: error: 'minute' was not declared in this scope
TimeSerial:41: error: 'second' was not declared in this scope
TimeSerial:43: error: 'day' was not declared in this scope
TimeSerial:45: error: 'month' was not declared in this scope
TimeSerial:47: error: 'year' was not declared in this scope
TimeSerial.pde: In function 'void processSyncMessage()':
TimeSerial:65: error: 'time_t' was not declared in this scope
TimeSerial:65: error: expected `;' before 'pctime'
TimeSerial:69: error: 'pctime' was not declared in this scope
TimeSerial:72: error: 'pctime' was not declared in this scope
TimeSerial:72: error: 'setTime' was not declared in this scope
TimeSerial.pde: At global scope:
TimeSerial:77: error: 'time_t' does not name a type

Am I working off of bad information or are the Examples broken out of the box?
« Last Edit: March 31, 2013, 05:52:27 pm by blentz » Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31436
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you missed a line off the start of the error messages, it normally will say it can't find a file.

It looks like the library is an old one. Read the two stickies at the start of this section for what to change inside your library files.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't think I missed anything... that's a complete copy/paste of the error message I am getting in the IDE. I'll attach a screenshot of the error just to be certain.

I will read the stickies but I would guess that if the examples are faulty out of the box... then I guess that's the answer to my question: They don't work right even from the beginning.

I am trying to use some of these library functions in another program. But even this is broke:
Code:
#include <Time.h>

void setup()  {
  setSyncProvider( requestSync);
}

void loop() {
}
Code:
sketch_mar31a.ino: In function 'void setup()':
sketch_mar31a:4: error: 'requestSync' was not declared in this scope
sketch_mar31a:4: error: 'setSyncProvider' was not declared in this scope


* Screen shot 2013-03-31 at 6.50.54 PM.png (35.42 KB, 446x624 - viewed 11 times.)
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31436
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

When you down load the library I think you must drag all the three folders individually into the libraries folder. So for the Time library un zip it and drag the DS1307RTC, the Time and the TimeAlarms folder separately.
When I do this I can get the examples to verify and I am on a Mac.
« Last Edit: March 31, 2013, 06:07:56 pm by Grumpy_Mike » Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you for your response.

As I said before, dropping the folders in makes the "Examples" and "Import Library..." menus update upon restarting the IDE to reflect the new libraries... so I think they're in the right place. Can you confirm?

Also, I have confirmed that Arduino, Preferences, Sketchbook location is set to the default of "/Users/blentz/Documents/Arduino"

Upon upgrading from 1.0.1 to 1.0.4 (something else I tried already) I did get a new directory at "/Users/blentz/Documents/Arduino/libraries" with a readme.txt file in it, so this all seems to be in the right place.

The directory structures are organized like this:

Code:
$ find /Users/blentz/Documents/Arduino/libraries -type d
/Users/blentz/Documents/Arduino/libraries
/Users/blentz/Documents/Arduino/libraries/Time
/Users/blentz/Documents/Arduino/libraries/Time/DS1307RTC
/Users/blentz/Documents/Arduino/libraries/Time/Time
/Users/blentz/Documents/Arduino/libraries/Time/Time/Examples
/Users/blentz/Documents/Arduino/libraries/Time/Time/Examples/Processing
/Users/blentz/Documents/Arduino/libraries/Time/Time/Examples/Processing/SyncArduinoClock
/Users/blentz/Documents/Arduino/libraries/Time/Time/Examples/TimeGPS
/Users/blentz/Documents/Arduino/libraries/Time/Time/Examples/TimeNTP
/Users/blentz/Documents/Arduino/libraries/Time/Time/Examples/TimeRTC
/Users/blentz/Documents/Arduino/libraries/Time/Time/Examples/TimeRTCLog
/Users/blentz/Documents/Arduino/libraries/Time/Time/Examples/TimeRTCSet
/Users/blentz/Documents/Arduino/libraries/Time/Time/Examples/TimeSerial
/Users/blentz/Documents/Arduino/libraries/Time/Time/Examples/TimeSerialDateStrings
/Users/blentz/Documents/Arduino/libraries/Time/TimeAlarms
/Users/blentz/Documents/Arduino/libraries/Time/TimeAlarms/Examples
/Users/blentz/Documents/Arduino/libraries/Time/TimeAlarms/Examples/TimeAlarmExample
/Users/blentz/Documents/Arduino/libraries/UDPbitewise
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/examples
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/examples/pd
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/examples/python
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/Ethernet
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/Ethernet/examples
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/Ethernet/examples/UdpReceiveBytewise
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/Ethernet/examples/UdpReceiveRaw
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/Ethernet/examples/UdpReceiveString
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/Ethernet/examples/UdpSendBytewise
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/Ethernet/examples/UdpSendRaw
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/Ethernet/examples/UdpSendString
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/String
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/String/examples
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/String/examples/StringTest2

Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31436
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Can you confirm?
No that setup is wrong, take them out of the enclosing Time folder like I said.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you. It still doesn't verify but at least the error messages seem somewhat easier to deal with.

Is there a better de-facto time library for the Arduino or is this what everyone is using?

The directory structure is now:

Code:
$ find /Users/blentz/Documents/Arduino/libraries -type d
/Users/blentz/Documents/Arduino/libraries
/Users/blentz/Documents/Arduino/libraries/DS1307RTC
/Users/blentz/Documents/Arduino/libraries/Time
/Users/blentz/Documents/Arduino/libraries/Time/Examples
/Users/blentz/Documents/Arduino/libraries/Time/Examples/Processing
/Users/blentz/Documents/Arduino/libraries/Time/Examples/Processing/SyncArduinoClock
/Users/blentz/Documents/Arduino/libraries/Time/Examples/TimeGPS
/Users/blentz/Documents/Arduino/libraries/Time/Examples/TimeNTP
/Users/blentz/Documents/Arduino/libraries/Time/Examples/TimeRTC
/Users/blentz/Documents/Arduino/libraries/Time/Examples/TimeRTCLog
/Users/blentz/Documents/Arduino/libraries/Time/Examples/TimeRTCSet
/Users/blentz/Documents/Arduino/libraries/Time/Examples/TimeSerial
/Users/blentz/Documents/Arduino/libraries/Time/Examples/TimeSerialDateStrings
/Users/blentz/Documents/Arduino/libraries/TimeAlarms
/Users/blentz/Documents/Arduino/libraries/TimeAlarms/Examples
/Users/blentz/Documents/Arduino/libraries/TimeAlarms/Examples/TimeAlarmExample
/Users/blentz/Documents/Arduino/libraries/UDPbitewise
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/examples
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/examples/pd
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/examples/python
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/Ethernet
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/Ethernet/examples
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/Ethernet/examples/UdpReceiveBytewise
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/Ethernet/examples/UdpReceiveRaw
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/Ethernet/examples/UdpReceiveString
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/Ethernet/examples/UdpSendBytewise
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/Ethernet/examples/UdpSendRaw
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/Ethernet/examples/UdpSendString
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/String
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/String/examples
/Users/blentz/Documents/Arduino/libraries/UDPbitewise/libraries/String/examples/StringTest2

TimeSerial, for example, now throws this instead:

Code:
TimeSerial.pde: In function 'time_t requestSync()':
TimeSerial:79: error: 'BYTE' was not declared in this scope

As of Arduino 1.0, the 'BYTE' keyword is no longer supported.
Please use Serial.write() instead.

TimeNTP throws:

Code:
TimeNTP.pde:12:2: error: #error : UDP packet size to small - modify UdpBytewise.h to set buffers to 64 bytes
TimeNTP.pde: In function 'long unsigned int getNtpTime()':
TimeNTP:81: error: 'UdpBytewise' was not declared in this scope
TimeNTP.pde: In function 'long unsigned int sendNTPpacket(byte*)':
TimeNTP:92: error: 'UdpBytewise' was not declared in this scope
TimeNTP.pde: In function 'long unsigned int getUlong()':
TimeNTP:109: error: 'UdpBytewise' was not declared in this scope
TimeNTP.pde: In function 'void write_n(int, int)':
TimeNTP:119: error: 'UdpBytewise' was not declared in this scope

Applying this:

Code:
--- ./Documents/Arduino/libraries/UDPbytewise/libraries/Ethernet/UdpBytewise.h.orig 2013-03-31 19:21:42.000000000 -0400
+++ ./Documents/Arduino/libraries/UDPbytewise/libraries/Ethernet/UdpBytewise.h 2013-03-31 19:22:06.000000000 -0400
@@ -38,8 +38,8 @@
 
 #include "Print.h"
 
-#define UDP_TX_PACKET_MAX_SIZE 32
-#define UDP_RX_PACKET_MAX_SIZE 32
+#define UDP_TX_PACKET_MAX_SIZE 64
+#define UDP_RX_PACKET_MAX_SIZE 64
 
 #define UDP_TX_OVERFLOW_TRUNCATE 0
 #define UDP_TX_OVERFLOW_SPLIT 1

Results in this:

Code:
TimeNTP.pde:12:2: error: #error : UDP packet size to small - modify UdpBytewise.h to set buffers to 64 bytes
TimeNTP.pde: In function 'long unsigned int getNtpTime()':
TimeNTP:81: error: 'UdpBytewise' was not declared in this scope
TimeNTP.pde: In function 'long unsigned int sendNTPpacket(byte*)':
TimeNTP:92: error: 'UdpBytewise' was not declared in this scope
TimeNTP.pde: In function 'long unsigned int getUlong()':
TimeNTP:109: error: 'UdpBytewise' was not declared in this scope
TimeNTP.pde: In function 'void write_n(int, int)':
TimeNTP:119: error: 'UdpBytewise' was not declared in this scope

I don't get it - "modify UdpBytewise.h to set buffers to 64 bytes" - modify in what way? I took a guess at "UDP_TX_PACKET_MAX_SIZE" and "UDP_RX_PACKET_MAX_SIZE" and struck out.
« Last Edit: March 31, 2013, 06:27:22 pm by blentz » Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 508
Posts: 31436
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Is there a better de-facto time library for the Arduino or is this what everyone is using?
I have no idea, I am rather against libraries because it stops people thinking and learning.
The release not says it has been updated for arduino 1.0.1 but clearly it has not.

Quote
TimeSerial, for example, now throws this instead:
I saw that it is simple to fix.
Change
Code:
Serial.print(TIME_REQUEST,BYTE); 
to
Code:
Serial.write((byte)TIME_REQUEST); 

I get the same error with the other one. Maybe someone else knows how to fix that one.


Logged

Pages: [1]   Go Up
Jump to: