Problems with mega 2650 on ver 22

My platform:

Ubuntu 10.10 32 bit
Arduino Mega 2650 with arduino Ethernet shield (want on Nanode as well)
Arduino version 22

Problem 1:

Got Arduino 22 from

Got NTP client code from

When I compile I get: ntp_client:40: error:

‘UDP’ does not name a type

Problem 2:

I downloaded the time library from the first post of this forum:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1262173131

and dropped it in my libraries arduino folder.

Then I copied from mems second code block form mem’s second post and saved it in my sketchbook as ntp_sync/ntp_sync.pde

I compile it at this point and it says:

ntp_sync.cpp:3:81: error: UdpBytewise.h: No such file or directory
ntp_sync.cpp: In function ‘long unsigned int getNtpTime()’:
ntp_sync:59: error: ‘UdpBytewise’ was not declared in this scope
ntp_sync.cpp: In function ‘long unsigned int sendNTPpacket(byte*)’:
ntp_sync:70: error: ‘UdpBytewise’ was not declared in this scope
ntp_sync.cpp: In function ‘long unsigned int getUlong()’:
ntp_sync:87: error: ‘UdpBytewise’ was not declared in this scope
ntp_sync.cpp: In function ‘void write_n(int, int)’:
ntp_sync:97: error: ‘UdpBytewise’ was not declared in this scope

So, I went to here on the playground

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1231346812

And found a link to here for the udp additions to the Ethernet library

https://bitbucket.org/bjoern/arduino_osc/src/tip/libraries/Ethernet/

I got the libraries from that download and merged them into my arduino library folder and it copied the String library in and merged the new UDP stuff into the Ethernet library.

I then compile the code and get:

In file included from /home/dsmurl/Desktop/arduino-0022/libraries/Ethernet/Ethernet.cpp:1:
/home/dsmurl/Desktop/arduino-0022/libraries/Ethernet/utility/w5100.h:14:17: error: SPI.h: No such file or directory

As of Arduino 0019, the Ethernet library depends on the SPI library.
You appear to be using it or another library that depends on the SPI library.

So I then modify the ntp_sync.pde with the following line at the top’

#include <SPI.h>

When I compile this I get:

/home/dsmurl/Desktop/arduino-0022/libraries/Ethernet/UdpString.cpp:33:19: error: types.h: No such

From what I understand types.h is missing or something in version 22 of the Arduino libraries and some forums have mentioned that it was last working in arduino version 18. My problem here is that I want to get this stuff work on 22 because I plan on using a mega 2650 which had a lot of problems on the version 18. Are there updated versions of these libraries somewhere for the 22?

My final goal is to build a web server on the mega 2650 with the Ethernet shield that knows to hit a time server on boot to insure that it always has the proper time. Maybe there is a simpler way to do this without udp since I’m building a web server anyways. I really want an accurate time on boot and the ability to sync if need be. Is there a simpler way to get a time server time? :smiley:

dsmurl:
My platform:

Ubuntu 10.10 32 bit
Arduino Mega 2650 with arduino Ethernet shield (want on Nanode as well)
Arduino version 22

Problem 1:

Got Arduino 22 from

http://arduino.cc/en/Main/Software

Got NTP client code from

http://arduino.cc/en/Tutorial/UdpNtpClient

When I compile I get: ntp_client:40: error:

‘UDP’ does not name a type

I loaded the Examples -> Ethernet -> UdpNtpClient with my board type set to Mega2560 on version 0022.

It compiled without errors.

I presume you have a mega 2560 board and not a mega 2650?

My test was on both Mac and Windows.

The code on the tutorial site indeed gave the error you mentioned but if you comment out the line:

UDP Udp;

... then it compiles OK.

In either case above I get:

/home/dsmurl/Desktop/arduino-0022/libraries/Ethernet/UdpString.cpp:33:19: error: types.h: No such file or directory

From what I understand, types.h used to be under the file system */arduino-0022/libraries/Ethernet but is no longer there for some reason and many of my examples can't find it.

I don't see where UdpString.cpp is in the Ethernet library.

It's from the UDP library here:

https://bitbucket.org/bjoern/arduino_osc/src/tip/libraries/Ethernet/

My first post explains how I found this library addition. I don't necessarily need this library though because I'm just trying to get a time sync via some sort of time server. If there is a more standard way of doing this that the community uses then I would like to know.

My first post Problem 2 shows the progression of how I ended up at this point. Maybe I am using some wrong libraries or something to accomplish this stuff.

I must have been confused somewhere or messed my libraries up. I re-downloaded version 22 and ran the upd_ntp_client program and it compiled fine and ran fine. I did however have to comment the line

UDP Udp;

All is working now I think. Thanks Nick.

  • Sam