Hardware Reference
In-Depth Information
13 boolean firstEmail = true;
14
15 int status = WL_IDLE_STATUS;
16
17 WiFiClient client; // Set up the wireless client
18
19 void setup()
20 {
21 Serial.begin(9600);
22
23
22 Serial.println("Plant monitor");
23
24 // Configure the LED pin, set as output, high
25 pinMode(LEDPin, OUTPUT);
26 digitalWrite(LEDPin, HIGH);
27
28 // Is there a WiFi shield installed?
29 if (WiFi.status() == WL_NO_SHIELD) {
30 Serial.println("ERR: WiFi shield not found");
31 // No point continuing with the sketch
32 while(true);
33 }
34
35 // Attempt to connect to the WiFi network
36 while ( status != WL_CONNECTED) {
37 Serial.print("Attempting to connect to WPA SSID: ");
38 Serial.println(ssid);
39 // Connect to WPA/WPA2 network:
40 status = WiFi.begin(ssid, pass);
41
42 // Wait 10 seconds for connection:
43 delay(10000);
44 }
45
46 // If we got here, then the connection is good. Set LED pin low
47 and display information on serial
48 digitalWrite(LEDPin, LOW);
49 Serial.println("Connected!");
50 }
51
52 void loop()
53 {
54 // Get a humidity reading
55 int val = getDht11Humidity();
56
57 // Print it out to the serial port
58 Serial.print("Current humidity: ");
59 Serial.print(val);
60 Serial.println("");
Continues
Search WWH ::




Custom Search