Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: main.cpp
- Revision:
- 3:fecb1929cbef
- Parent:
- 2:dd10c541a3dc
--- a/main.cpp Mon Mar 14 03:11:03 2016 +0000
+++ b/main.cpp Mon Apr 04 08:49:41 2016 +0000
@@ -1,18 +1,19 @@
#include "mbed.h"
#include "TSL2591.h"
+#include "BME280.h"
-I2C i2c1(PB_9, PB_8);
-TSL2591 sensor(i2c1, TSL2591_ADDR);
-
-DigitalOut myled(LED1);
+I2C i2c1(I2C_SDA, I2C_SCL);
+BME280 sensor(i2c1, BME280_ADDR_L);
+TSL2591 sensor1(i2c1, TSL2591_ADDR);
int main()
{
sensor.init();
while(1) {
- sensor.getALS();
- sensor.calcLux();
- printf("%d \t %d \t %d \t %d\n",sensor.full,sensor.ir,sensor.visible,sensor.lux);
- wait(0.5);
+ sensor1.getALS();
+ sensor1.calcLux();
+ printf("%d \t %d \t %d \t %d\n",sensor1.full,sensor1.ir,(int16_t)sensor1.visible,sensor1.lux);
+ printf("%2.2f degC, %04.2f hPa, %2.2f %%\n", sensor.getTemperature(), sensor.getPressure(), sensor.getHumidity());
+ wait(1);
}
}
\ No newline at end of file