Skip to content

Commit fee7de8

Browse files
committed
Merge branch 'master' of github.com:arduino/Arduino into diskloader_reboot
Conflicts: app/src/processing/app/Editor.java app/src/processing/app/Sketch.java build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde build/shared/lib/theme/theme.txt hardware/arduino/cores/arduino/HardwareSerial.h hardware/arduino/cores/arduino/Print.cpp hardware/arduino/cores/arduino/WString.h hardware/arduino/variants/mega/pins_arduino.h libraries/Ethernet/examples/PachubeClient/PachubeClient.ino libraries/Ethernet/examples/PachubeClientString/PachubeClientString.ino libraries/Firmata/examples/EchoString/EchoString.ino libraries/SD/File.cpp libraries/SoftwareSerial/SoftwareSerial.cpp libraries/SoftwareSerial/SoftwareSerial.h libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino libraries/SoftwareSerial/keywords.txt
2 parents 5a8d500 + e32f5ee commit fee7de8

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed

examples/PachubeClient/PachubeClient.ino

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,28 +23,32 @@
2323
#include <Ethernet.h>
2424

2525
// assign a MAC address for the ethernet controller.
26-
// Newer Ethernet shields have a MAC address printed on a sticker on the shield
2726
// fill in your address here:
2827
byte mac[] = {
2928
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
29+
// assign an IP address for the controller:
30+
byte ip[] = {
31+
192,168,1,20 };
32+
byte gateway[] = {
33+
192,168,1,1};
34+
byte subnet[] = {
35+
255, 255, 255, 0 };
36+
37+
// The address of the server you want to connect to (pachube.com):
38+
byte server[] = {
39+
173,203,98,29 };
3040

3141
// initialize the library instance:
32-
EthernetClient client;
42+
Client client(server, 80);
3343

3444
long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
3545
boolean lastConnected = false; // state of the connection last time through the main loop
3646
const int postingInterval = 10000; //delay between updates to Pachube.com
3747

3848
void setup() {
39-
// start serial port:
49+
// start the ethernet connection and serial port:
50+
Ethernet.begin(mac, ip);
4051
Serial.begin(9600);
41-
// start the Ethernet connection:
42-
if (Ethernet.begin(mac) == 0) {
43-
Serial.println("Failed to configure Ethernet using DHCP");
44-
// no point in carrying on, so do nothing forevermore:
45-
for(;;)
46-
;
47-
}
4852
// give the ethernet module time to boot up:
4953
delay(1000);
5054
}
@@ -82,7 +86,7 @@ void loop() {
8286
// this method makes a HTTP connection to the server:
8387
void sendData(int thisData) {
8488
// if there's a successful connection:
85-
if (client.connect("www.pachube.com", 80)) {
89+
if (client.connect()) {
8690
Serial.println("connecting...");
8791
// send the HTTP PUT request.
8892
// fill in your feed address here:

examples/PachubeClientString/PachubeClientString.ino

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,29 @@
2828
// fill in your address here:
2929
byte mac[] = {
3030
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
31+
// assign an IP address for the controller:
32+
byte ip[] = {
33+
192,168,1,20 };
34+
byte gateway[] = {
35+
192,168,1,1};
36+
byte subnet[] = {
37+
255, 255, 255, 0 };
38+
39+
// The address of the server you want to connect to (pachube.com):
40+
byte server[] = {
41+
173,203,98,29 };
3142

3243
// initialize the library instance:
33-
EthernetClient client;
44+
Client client(server, 80);
3445

3546
long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
3647
boolean lastConnected = false; // state of the connection last time through the main loop
3748
const int postingInterval = 10000; //delay between updates to Pachube.com
3849

3950
void setup() {
4051
// start the ethernet connection and serial port:
52+
Ethernet.begin(mac, ip);
4153
Serial.begin(9600);
42-
if (Ethernet.begin(mac) == 0) {
43-
Serial.println("Failed to configure Ethernet using DHCP");
44-
// no point in carrying on, so do nothing forevermore:
45-
for(;;)
46-
;
47-
}
4854
// give the ethernet module time to boot up:
4955
delay(1000);
5056
}
@@ -90,7 +96,7 @@ void loop() {
9096
// this method makes a HTTP connection to the server:
9197
void sendData(String thisData) {
9298
// if there's a successful connection:
93-
if (client.connect("www.pachube.com", 80)) {
99+
if (client.connect()) {
94100
Serial.println("connecting...");
95101
// send the HTTP PUT request.
96102
// fill in your feed address here:

0 commit comments

Comments
 (0)