18
18
* Analog sensor attached to analog in 0
19
19
* Wifi shield attached to pins 10, 11, 12, 13
20
20
21
- created 13 March 2012
21
+ created 16 March 2012
22
22
by Tom Igoe
23
23
24
24
This code is in the public domain.
@@ -42,8 +42,8 @@ WiFiClient client;
42
42
43
43
// if you don't want to use DNS (and reduce your sketch size)
44
44
// 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
47
47
48
48
unsigned long lastConnectionTime = 0 ; // last time you connected to the server, in milliseconds
49
49
boolean lastConnected = false ; // state of the connection last time through the main loop
@@ -63,6 +63,7 @@ void setup() {
63
63
}
64
64
else {
65
65
Serial.println (" Connected to wifi" );
66
+ printWifiStatus ();
66
67
}
67
68
}
68
69
@@ -142,3 +143,21 @@ void sendData(String thisData) {
142
143
lastConnectionTime = millis ();
143
144
}
144
145
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