mirror of
https://github.com/esp8266/Arduino.git
synced 2025-10-19 21:09:48 +03:00
Merge remote branch 'origin/hd_2.7'
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
* Wifi shield attached to pins 10, 11, 12, 13
|
||||
|
||||
created 16 Mar 2012
|
||||
modified 14 May 2012
|
||||
modified 31 May 2012
|
||||
by Tom Igoe
|
||||
modified 8 Sept 2012
|
||||
by Scott Fitzgerald
|
||||
@@ -53,14 +53,26 @@ boolean lastConnected = false; // state of the connection last t
|
||||
const unsigned long postingInterval = 10*1000; //delay between updates to pachube.com
|
||||
|
||||
void setup() {
|
||||
// start serial port:
|
||||
Serial.begin(9600);
|
||||
|
||||
//Initialize serial and wait for port to open:
|
||||
Serial.begin(9600);
|
||||
while (!Serial) {
|
||||
; // wait for serial port to connect. Needed for Leonardo only
|
||||
}
|
||||
|
||||
// check for the presence of the shield:
|
||||
if (WiFi.status() == WL_NO_SHIELD) {
|
||||
Serial.println("WiFi shield not present");
|
||||
// don't continue:
|
||||
while(true);
|
||||
}
|
||||
|
||||
// attempt to connect to Wifi network:
|
||||
while ( status != WL_CONNECTED) {
|
||||
Serial.print("Attempting to connect to SSID: ");
|
||||
Serial.println(ssid);
|
||||
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
|
||||
status = WiFi.begin(ssid, pass);
|
||||
|
||||
// wait 10 seconds for connection:
|
||||
delay(10000);
|
||||
}
|
||||
@@ -85,7 +97,7 @@ void loop() {
|
||||
// if there's incoming data from the net connection.
|
||||
// send it out the serial port. This is for debugging
|
||||
// purposes only:
|
||||
if (client.available()) {
|
||||
while (client.available()) {
|
||||
char c = client.read();
|
||||
Serial.print(c);
|
||||
}
|
||||
|
Reference in New Issue
Block a user