by alverman » Thu Feb 03, 2011 4:28 pm
My arduino Sketch
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0x90, 0xA2, 0xDA, 0x00, 0x08, 0xE6 }; // Eth shield Mac
byte ip[] = { 192,168,1,10 }; // Arduino
byte server[] = { 192,168,1,195 }; // Widget
int Dx = 0;
int Sx = 0;
// Initialize the Ethernet client library
// with the IP address and port of the server
Client client(server, 8084);
void setup() {
// start the Ethernet connection:
Ethernet.begin(mac, ip);
// start the serial library:
Serial.begin(115200);
// 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()) {
Serial.println("connected");
}
else {
// if you didn't get a connection to the server:
Serial.println("connection failed");
}
}
void loop()
{
Dx = analogRead(0);
Sx = analogRead(1);
client.print ("*");
client.print(Dx);
client.print ("@");
client.print(Sx);
client.print ("#");
if (!client.connected())
{
Serial.println("disconnecting.");
client.stop();
}
}
You do not have the required permissions to view the files attached to this post.
PROService -IT
Intel i7 2600K LGA1155
MB P8H67-MLE 16GB
2xSSD 250GB
GTX470
Win 8.1 PRO
Manager STD V6.1
Player PRO V6.1
WDPro V5 2500
** La famiglia ti nutre, ti veste .... finchè non sei pronto per girare il mondo alla ricerca di qualcosa di tuo. **