1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-30 16:24:09 +03:00

Run new astyle formatter against all the examples

This commit is contained in:
Federico Fissore
2013-10-21 09:58:40 +02:00
parent 3c6ee46828
commit b4c68b3dff
259 changed files with 5160 additions and 5217 deletions

View File

@ -1,23 +1,23 @@
/*
Repeating Web client
This sketch connects to a a web server and makes a request
using a Wiznet Ethernet shield. You can use the Arduino Ethernet shield, or
the Adafruit Ethernet shield, either one will work, as long as it's got
a Wiznet Ethernet module on board.
This example uses DNS, by assigning the Ethernet client with a MAC address,
IP address, and DNS address.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
created 19 Apr 2012
by Tom Igoe
http://arduino.cc/en/Tutorial/WebClientRepeating
This code is in the public domain.
*/
#include <SPI.h>
@ -25,14 +25,15 @@
// assign a MAC address for the ethernet controller.
// fill in your address here:
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
byte mac[] = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
// fill in an available IP address on your network here,
// for manual configuration:
IPAddress ip(10,0,0,20);
IPAddress ip(10, 0, 0, 20);
// fill in your Domain Name Server address here:
IPAddress myDns(1,1,1,1);
IPAddress myDns(1, 1, 1, 1);
// initialize the library instance:
EthernetClient client;
@ -41,8 +42,8 @@ char server[] = "www.arduino.cc";
unsigned long lastConnectionTime = 0; // last time you connected to the server, in milliseconds
boolean lastConnected = false; // state of the connection last time through the main loop
const unsigned long postingInterval = 60L*1000L; // delay between updates, in milliseconds
// the "L" is needed to use long type numbers
const unsigned long postingInterval = 60L * 1000L; // delay between updates, in milliseconds
// the "L" is needed to use long type numbers
void setup() {
// start serial port:
@ -75,7 +76,7 @@ void loop() {
// if you're not connected, and ten seconds have passed since
// your last connection, then connect again and send data:
if(!client.connected() && (millis() - lastConnectionTime > postingInterval)) {
if (!client.connected() && (millis() - lastConnectionTime > postingInterval)) {
httpRequest();
}
// store the state of the connection for next time through
@ -97,7 +98,7 @@ void httpRequest() {
// note the time that the connection was made:
lastConnectionTime = millis();
}
}
else {
// if you couldn't make a connection:
Serial.println("connection failed");