Sets up LCD and prints sensor data value of TSL2561 light sensor to LCD

Dependencies:   C12832 Sht31 TSL2561

Fork of mbed-cloud-connect-sensor-air-quality by Andrea Corrado

Committer:
andcor02
Date:
Wed Nov 01 13:25:53 2017 +0000
Revision:
1:76a5fa924120
Parent:
0:80032665d37e
Child:
2:587b4d7444d1
clear screen

Who changed what in which revision?

UserRevisionLine numberNew contents of line
andcor02 0:80032665d37e 1 #include "mbed.h"
andcor02 0:80032665d37e 2 #include "C12832.h"
andcor02 0:80032665d37e 3 #include "CCS811.h"
andcor02 0:80032665d37e 4
andcor02 0:80032665d37e 5 /* Sets up LCD and prints sensor data value of Indoor Air Quality sensor to LCD */
andcor02 0:80032665d37e 6
andcor02 0:80032665d37e 7 C12832 lcd(PE_14, PE_12, PD_12, PD_11, PE_9); //LCD: MOSI, SCK, RESET, A0, nCS
andcor02 0:80032665d37e 8 CCS811 ccs811(PF_0, PF_1); //IAQ SENSOR: I2C_SDA, I2C_SCL
andcor02 0:80032665d37e 9
andcor02 0:80032665d37e 10 int main()
andcor02 0:80032665d37e 11 {
andcor02 0:80032665d37e 12 ccs811.init();
andcor02 0:80032665d37e 13
andcor02 0:80032665d37e 14 while(1) {
andcor02 0:80032665d37e 15 uint16_t eco2, tvoc;
andcor02 0:80032665d37e 16 ccs811.readData(&eco2, &tvoc);
andcor02 0:80032665d37e 17
andcor02 0:80032665d37e 18 lcd.locate(0,3);
andcor02 0:80032665d37e 19 lcd.printf("[AIR QUAL]");
andcor02 0:80032665d37e 20 lcd.locate(0,15);
andcor02 0:80032665d37e 21 lcd.printf("eCO2:%dppm, TVO:%dppb", eco2, tvoc); // Print to LCD values
andcor02 1:76a5fa924120 22 wait(1);
andcor02 1:76a5fa924120 23 lcd.cls();
andcor02 0:80032665d37e 24 }
andcor02 0:80032665d37e 25 }