-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsparky-OLD.ino
57 lines (44 loc) · 1.18 KB
/
sparky-OLD.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
Original Code by Tom Igoe
edited John Schimmel
*/
#include <SPI.h>
#include <Ethernet.h>
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
//your arduino's IP address might need to change depending on your network
byte ip[] = {
192,168,1,111};
// IMPORTANT
// CHANGE THE SERVER IP ADDRESS
byte server[] = {
192,168,1,100};
// Initialize the Ethernet client library
// with the IP address and port of the server
EthernetClient client(server, 1337);
void setup() {
// start the Ethernet connection:
Ethernet.begin(mac, ip);
// start the serial library:
Serial.begin(9600);
// 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()
{
//if you are connected and data is available
if (client.available()) {
char c = client.read();
Serial.print(c);
}
}