Quantcast
Channel: Intel Communities: Message List
Viewing all articles
Browse latest Browse all 18548

Galileo Ethernet WebClient

$
0
0

hello,

 

I am trying to get the WebClient arduino example sketch running on a Galileo (below). The sketch uploads fine but is resulting in nothing at all being displayed in the serial monitor. I have only changed the MAC address which I interpreted to be "  0x98, 0x4F, 0xEE, 0x00, 0x90, 0xAF " from the sticker label "984FEE0090AF" on the ethernet connection port. The LAN is DHCP enabled.

 

The other sketch I have tried is the DhcpAddressPrinter sketch but this has the same issue of returning nothing on the serial monitor.

 

Can anyone help me with this issue.

 

Thanks.

 

 

#include <SPI.h>

#include <Ethernet.h>

 

 

// Enter a MAC address for your controller below.

// Newer Ethernet shields have a MAC address printed on a sticker on the shield

byte mac[] = {  0x98, 0x4F, 0xEE, 0x00, 0x90, 0xAF };

IPAddress server(173,194,33,104); // Google

 

 

// Initialize the Ethernet client library

// with the IP address and port of the server

// that you want to connect to (port 80 is default for HTTP):

EthernetClient client;

 

 

void setup() {

// Open serial communications and wait for port to open:

  Serial.begin(9600);

   while (!Serial) {

    ; // wait for serial port to connect. Needed for Leonardo only

  }

 

 

  // start the Ethernet connection:

  if (Ethernet.begin(mac) == 0) {

    Serial.println("Failed to configure Ethernet using DHCP");

    // no point in carrying on, so do nothing forevermore:

    for(;;)

      ;

  }

  // give the Ethernet shield a second to initialize:

  delay(1000);

  Serial.println("connecting...");

 

 

  // if you get a connection, report back via serial:

  if (client.connect(server, 80)) {

    Serial.println("connected");

    // Make a HTTP request:

    client.println("GET /search?q=arduino HTTP/1.0");

    client.println();

  }

  else {

    // if you didn't get a connection to the server:

    Serial.println("connection failed");

  }

}

 

 

void loop()

{

  // if there are incoming bytes available

  // from the server, read them and print them:

  if (client.available()) {

    char c = client.read();

    Serial.print(c);

  }

 

 

  // if the server's disconnected, stop the client:

  if (!client.connected()) {

    Serial.println();

    Serial.println("disconnecting.");

    client.stop();

 

 

    // do nothing forevermore:

    for(;;)

      ;

  }

}


Viewing all articles
Browse latest Browse all 18548

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>