3 Sensors

Dependencies:   BSP_DISCO_F746NG BME280

Revision:
0:3f09104467d2
Child:
1:bea4451dcea2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jan 13 15:09:07 2020 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+#include "stm32746g_discovery_lcd.h"
+#include "stm32746g_discovery_ts.h"
+#include "BME280.h"
+
+Serial pc(USBTX, USBRX);
+
+#if defined(TARGET_LPC1768)
+ BME280 sensor(PB_9, PB_8);
+#else
+ BME280 sensor(I2C_SDA, I2C_SCL);
+#endif
+TS_StateTypeDef TS_State;
+
+float x=0;
+uint8_t y=0;
+uint8_t text[30];
+uint8_t idx;
+ 
+int main()
+{
+    BSP_LCD_Init();
+    BSP_LCD_LayerDefaultInit(LTDC_ACTIVE_LAYER, LCD_FB_START_ADDRESS);
+    BSP_LCD_SelectLayer(LTDC_ACTIVE_LAYER);
+    BSP_LCD_Clear(LCD_COLOR_BLACK);
+    
+
+    while (1) {
+        
+
+        BSP_LCD_SetBackColor(LCD_COLOR_BLACK);
+        BSP_LCD_SetTextColor(LCD_COLOR_ORANGE);
+
+        x = sensor.getTemperature();
+        y = sensor.getPressure();
+        sprintf((char*)text, "%2.2f degC",x);
+        BSP_LCD_DisplayStringAt(0, LINE(idx+1), (uint8_t *)&text, CENTER_MODE);
+        
+        //HAL_Delay(500);
+
+    }
+}