3 Sensors

Dependencies:   BSP_DISCO_F746NG BME280

main.cpp

Committer:
inistol
Date:
4 months ago
Revision:
0:3f09104467d2
Child:
1:bea4451dcea2

File content as of revision 0:3f09104467d2:

#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);

    }
}