1818 * Analog sensor attached to analog in 0
1919 * Wifi shield attached to pins 10, 11, 12, 13
2020
21- created 13 March 2012
21+ created 16 March 2012
2222 by Tom Igoe
2323
2424 This code is in the public domain.
@@ -42,8 +42,8 @@ WiFiClient client;
4242
4343// if you don't want to use DNS (and reduce your sketch size)
4444// use the numeric IP instead of the name for the server:
45- IPAddress server (216 ,52 ,233 ,122 ); // numeric IP for api.pachube.com
46- // char server[] = "api.pachube.com"; // name address for pachube API
45+ // IPAddress server(216,52,233,122); // numeric IP for api.pachube.com
46+ char server[] = " api.pachube.com" ; // name address for pachube API
4747
4848unsigned long lastConnectionTime = 0 ; // last time you connected to the server, in milliseconds
4949boolean lastConnected = false ; // state of the connection last time through the main loop
@@ -63,6 +63,7 @@ void setup() {
6363 }
6464 else {
6565 Serial.println (" Connected to wifi" );
66+ printWifiStatus ();
6667 }
6768}
6869
@@ -142,3 +143,21 @@ void sendData(String thisData) {
142143 lastConnectionTime = millis ();
143144}
144145
146+
147+ void printWifiStatus () {
148+ // print the SSID of the network you're attached to:
149+ Serial.print (" SSID: " );
150+ Serial.println (WiFi.SSID ());
151+
152+ // print your WiFi shield's IP address:
153+ IPAddress ip = WiFi.localIP ();
154+ Serial.print (" IP Address: " );
155+ Serial.println (ip);
156+
157+ // print the received signal strength:
158+ long rssi = WiFi.RSSI ();
159+ Serial.print (" signal strength (RSSI):" );
160+ Serial.print (rssi);
161+ Serial.println (" dBm" );
162+ }
163+
0 commit comments