Edwin Cho
/
TSL2591
Adafruit TSL2591 sensor
main.cpp@4:66ce66d4c07c, 2016-04-04 (annotated)
- Committer:
- 12104404
- Date:
- Mon Apr 04 09:09:12 2016 +0000
- Revision:
- 4:66ce66d4c07c
- Parent:
- 3:fecb1929cbef
<<1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
12104404 | 0:815555c72774 | 1 | #include "mbed.h" |
12104404 | 0:815555c72774 | 2 | #include "TSL2591.h" |
12104404 | 3:fecb1929cbef | 3 | #include "BME280.h" |
12104404 | 0:815555c72774 | 4 | |
12104404 | 3:fecb1929cbef | 5 | I2C i2c1(I2C_SDA, I2C_SCL); |
12104404 | 3:fecb1929cbef | 6 | BME280 sensor(i2c1, BME280_ADDR_L); |
12104404 | 3:fecb1929cbef | 7 | TSL2591 sensor1(i2c1, TSL2591_ADDR); |
12104404 | 0:815555c72774 | 8 | |
12104404 | 0:815555c72774 | 9 | int main() |
12104404 | 0:815555c72774 | 10 | { |
12104404 | 0:815555c72774 | 11 | sensor.init(); |
12104404 | 0:815555c72774 | 12 | while(1) { |
12104404 | 3:fecb1929cbef | 13 | sensor1.getALS(); |
12104404 | 3:fecb1929cbef | 14 | sensor1.calcLux(); |
12104404 | 3:fecb1929cbef | 15 | printf("%d \t %d \t %d \t %d\n",sensor1.full,sensor1.ir,(int16_t)sensor1.visible,sensor1.lux); |
12104404 | 3:fecb1929cbef | 16 | printf("%2.2f degC, %04.2f hPa, %2.2f %%\n", sensor.getTemperature(), sensor.getPressure(), sensor.getHumidity()); |
12104404 | 3:fecb1929cbef | 17 | wait(1); |
12104404 | 0:815555c72774 | 18 | } |
12104404 | 0:815555c72774 | 19 | } |