Code-Basis für Programm zum Taster-Entprellen
Fork of Laser-Distance by
main.cpp@0:80032665d37e, 2017-11-01 (annotated)
- Committer:
- andcor02
- Date:
- Wed Nov 01 13:20:56 2017 +0000
- Revision:
- 0:80032665d37e
- Child:
- 1:76a5fa924120
/* Sets up LCD and prints sensor data value of Indoor Air Quality sensor CCS811 to LCD */
Who changed what in which revision?
User | Revision | Line number | New 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 | 0:80032665d37e | 22 | } |
andcor02 | 0:80032665d37e | 23 | } |