Pages: [1]   Go Down
Author Topic: Sketch using Ethernet shield  (Read 1265 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 8
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm just learning about Arduino and specifically the Ethernet library and the DHCP library I downloaded. I thought I'd copied the example of this script correctly, but i keep getting errors such as:

In file included from DHCP_Test.cpp:9:
C:\Users\Impresario\Documents\Arduino\arduino-0022\libraries\DHCP/Dhcp.h:8:29: error: utility/types.h: No such file or directory
In file included from DHCP_Test.cpp:9:
C:\Users\Impresario\Documents\Arduino\arduino-0022\libraries\DHCP/Dhcp.h:120: error: 'u_char' does not name a type
C:\Users\Impresario\Documents\Arduino\arduino-0022\libraries\DHCP/Dhcp.h:121: error: 'u_char' does not name a type

Here is the short sketch. I would be ever so grateful for any help!

#if ARDUINO > 18
#include <SPI.h>
#endif
#include <Client.h>
#include <Ethernet.h>
#include <Server.h>
#include <Udp.h>

#include "Dhcp.h"

byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x50, 0xDD };
// IP addressing automatic
byte server[] = { 209, 85, 229,104}; // Google

Client client(server, 80);

void setup()
{
  Serial.begin(9600);
  if(Dhcp.beginWithDHCP(mac) == 1) // begin method returns 1 if successful
  {
    Serial.println("got IP address, connecting...");
    delay(5000);
  }
  else
  {
    Serial.println("unable to acquire ip address!");
    while(true) ; // do nothing
  }

  if (client.connect())
  {
    Serial.println("connected");
    client.println("GET /search?q=arduino HTTP/1.0");
    client.println();
  }
  else
  {
    Serial.println("connection failed");
  }
}

void loop()
{
  if (client.available())
  {
    char c = client.read();
    Serial.print(c);
  }
 
  if (!client.connected())
  {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    for(;smiley-wink ;
  }
}
Logged

2nd star on the right
Offline Offline
Full Member
***
Karma: 0
Posts: 103
Everything I am is classified under the official secreats act!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

1, Use The code tages to display code /\ the # symbol above.

Quote
C:\Users\Impresario\Documents\Arduino\arduino-0022\libraries\DHCP/Dhcp.h:8:29: error: utility/types.h: No such file or directory
In file included from DHCP_Test.cpp:9:

Simple question - does the file utility/types.h file exist in the libraries folder?

If it doesn't or its not recognised then that may be the reason for the other issues.
Logged

Sorry for the noobish post but my knowledge is 10 years out of date!

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

No, the utility/types.h file is nowhere to be found and I did recognize this as the core issue. I guess I wonder where to get that from and why it wouldn'd have been part of the DHCP library that called for it.

Thanks for responding!
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 611
Posts: 49092
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I guess I wonder where to get that from and why it wouldn'd have been part of the DHCP library that called for it.
Where did you get your DHCP library? Where did you put the contents?
Logged

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

It came the jordan.terrell blog called Arduino DHCP Library V0.4 (just now realized the entry is labedl April 2009, so it may be dated). I moved it into the arduino-0022\library.
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 611
Posts: 49092
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's a hint. When someone asks you where you got something, they mean for you to post a URL, not a vague description of a site.
Logged

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

Sorry:

http://blog.jordanterrell.com/post/Arduino-DHCP-Library-Version-04.aspx
Logged

Canton, Ohio
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am having the same issue.  I am using the same version of Arduino (022) and the same version of Jordan Terrell's DHCP library.

This is a little dated library, but is seems that there is not a lot out there.  Any help would be appreciated.
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9560
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I am having the same issue.  I am using the same version of Arduino (022) and the same version of Jordan Terrell's DHCP library.

On that site:

Quote
Update 7/3/2011: This library no longer works with current builds of Arduino.  At some point in the future I *may* decide to create a new revision, but my current focus is not on Arduino development.

The below link has code that works with IDE 0021:

http://gkaindl.com/software/arduino-ethernet
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Canton, Ohio
Offline Offline
Newbie
*
Karma: 0
Posts: 3
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks zoomkat!  That link to the library is functional with the latest version of Arduino (022).  I downloaded and installed the library and ran the example included with the DHCP library and everything compiled and ran without modification.
Logged

Pages: [1]   Go Up
Jump to: