Sets up LCD and prints sensor data value of MMA7660 accelerometer sensor to LCD

Dependencies:   C12832 MMA7660 Sht31

Fork of mbed-cloud-connect-sensor-light by Andrea Corrado

Files at this revision

API Documentation at this revision

Comitter:
andcor02
Date:
Thu Nov 02 10:43:07 2017 +0000
Parent:
2:587b4d7444d1
Child:
4:ef7abafa9884
Commit message:
Sets up LCD and prints sensor data value of TSL2561 light sensor to LCD

Changed in this revision

CCS811.lib Show diff for this revision Revisions of this file
TSL2561.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/CCS811.lib	Thu Nov 02 10:05:00 2017 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-https://developer.mbed.org/users/andcor02/code/CCS811/#64a96d555ef0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TSL2561.lib	Thu Nov 02 10:43:07 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/users/andcor02/code/TSL2561/#8146a28a20cc
--- a/main.cpp	Thu Nov 02 10:05:00 2017 +0000
+++ b/main.cpp	Thu Nov 02 10:43:07 2017 +0000
@@ -1,25 +1,27 @@
 #include "mbed.h"
 #include "C12832.h"
-#include "CCS811.h"
+#include "TSL2561.h"
 
 /* Sets up LCD and prints sensor data value of Indoor Air Quality sensor to LCD */
 
 C12832 lcd(PE_14, PE_12, PD_12, PD_11, PE_9); //LCD: MOSI, SCK, RESET, A0, nCS
-CCS811 ccs811(PF_0, PF_1); //IAQ SENSOR: I2C_SDA, I2C_SCL
+TSL2561 tsl2561(PF_0, PF_1, TSL2561_ADDR_HIGH); //LIGHT SENSOR: I2C_SDA, I2C_SCL 
 
 int main()
 {
-    ccs811.init();
-    
+    tsl2561.begin();
+    tsl2561.setGain(TSL2561_GAIN_0X);
+    tsl2561.setTiming(TSL2561_INTEGRATIONTIME_402MS);
+
     while(1) {
-        uint16_t eco2, tvoc;
-        ccs811.readData(&eco2, &tvoc);
-        
+        int x = tsl2561.getLuminosity(TSL2561_VISIBLE);
+        int z = tsl2561.getLuminosity(TSL2561_INFRARED);
+           
+        lcd.cls();
         lcd.locate(0,3);
-        lcd.printf("[AIR QUAL]");
-        lcd.locate(0,15);
-        lcd.printf("eCO2:%dppm, TVO:%dppb", eco2, tvoc); // Print to LCD values
-        wait(1);
-        lcd.cls();
+        lcd.printf("[LIGHT]");
+        lcd.locate(0,14);
+        lcd.printf("VIS: %d, INFR: %d ",x, z);
+        wait(1); // Print to LCD values
     }
 }
\ No newline at end of file