Go Down

Topic: Sending data with Ethernet (Read 816 times) previous topic - next topic


Hi there

I had a look at ksduino but I am very close to finishing and figured I would just carry on the path I am on.

I got one arduino posting the data to a web address which is great.  Does anyone have any examples or suggests of places of where to look for code of an arduino connecting to a web page to collect data?  My web page is very very simple - a few lines with a value on each line.  My web page is formatted as follows -

Wind speed - 1.57
Wind direction - 55
Wind speed - 1.57
Temperature - 3.06
dewpoint - 3.40
Pressure - 1011.00
Humidity - 94
Days - 18
Months - 12
Years - 2012
Hours - 18
Minutes - 4



I'll finish one new KSduino example and description soon. In this example one Arduino will send data to another one. I'll send link to you when this test will be ready. I can help you to add all your parameters when this test and description will be finished.
Best regards,
Kirill Scherba.


OK, this is Send to Other KSduino example at online documentation: http://ksduino.org/?docs=send_to_other_8ino-example.html
You should download latest KSduino library from the downloads page to run it: http://ksduino.org/?downloads
Best regards,
Kirill Scherba.


Client code that when the arduino receives an e from the serial monitor, the arduino gets a test file from my web server and sends it to the serial monitor. You can try it downloading the page from your web site.

Code: [Select]

//zoomkat 9-22-12
//simple client test
//for use with IDE 1.0.1
//with DNS, DHCP, and Host
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address

char serverName[] = "web.comporium.net"; // zoomkat's test web page server
EthernetClient client;


void setup(){

  if (Ethernet.begin(mac) == 0) {
    Serial.println("Failed to configure Ethernet using DHCP");
    // no point in carrying on, so do nothing forevermore:

  Serial.println("Better client test 9/22/12"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
      sendGET(); // call sendGET function below when byte is an e


void sendGET() //client function to send/receive GET request data.
  if (client.connect(serverName, 80)) {  //starts client connection, checks for connection
    client.println("GET /~shb/arduino.txt HTTP/1.0"); //download text
    client.println("Host: web.comporium.net");
    client.println(); //end of get request
  else {
    Serial.println("connection failed"); //error message if no client connect

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor

  client.stop(); //stop client


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


Best regards,
Kirill Scherba.

Go Up