Deep Slumber, codename ISA, is a program made for the arm MBED during Hack The Burgh 2018 that analyses light, temperature, humidity and CO2 levels in a room. It uploads this information onto an SQL server through a rest API, providing the necessary environment for data processing. Further improvements we hope to provide are the regulation of said parameters by wifi connection to electric heaters, wifi enabled controllable lightbulbs and other iot gadgets as well as a website that will provide recommendations for sleep cycle improvements.

Dependencies:   C12832 CCS811 Sht31 TSL2561

Fork of ARM_HACK_THE_BURGH by Carey Williams

Revision:
37:3a31525e2971
Parent:
35:052c1ba06ce7
Child:
44:63be19b7a3db
--- a/main.cpp	Wed Sep 27 11:15:04 2017 +0100
+++ b/main.cpp	Fri Sep 29 10:15:04 2017 +0100
@@ -59,7 +59,7 @@
     }
 }
 
-void scan_demo(WiFiInterface *wifi)
+int scan_demo(WiFiInterface *wifi)
 {
     WiFiAccessPoint *ap;
 
@@ -81,6 +81,7 @@
     printf("%d networks available.\n", count);
 
     delete[] ap;
+    return count;
 }
 
 void http_demo(NetworkInterface *net)
@@ -132,11 +133,17 @@
 
 int main()
 {
+    int count = 0;
+
     printf("WiFi example\n\n");
 
-    scan_demo(&wifi);
+    count = scan_demo(&wifi);
+    if (count == 0) {
+        printf("No WIFI APNs found - can't continue further.\n");
+        return -1;
+    }
 
-    printf("\nConnecting...\n");
+    printf("\nConnecting to %s...\n", MBED_CONF_APP_WIFI_SSID);
     int ret = wifi.connect(MBED_CONF_APP_WIFI_SSID, MBED_CONF_APP_WIFI_PASSWORD, NSAPI_SECURITY_WPA_WPA2);
     if (ret != 0) {
         printf("\nConnection error\n");