Sandeep Dwivedi
Created February 26, 2023

wheather forecaster with Infineon CY8CKIT-041-41XX PSoC™ 410

Weather forecasting is an important aspect of our daily lives, and having access to accurate weather information can help us plan

14
wheather forecaster with Infineon CY8CKIT-041-41XX PSoC™ 410

Things used in this project

Hardware components

Infineon CY8CKIT-041-41XX PSoC™ 4100S CapSense Pioneer Kit
×1
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×1
Grove - Barometer Sensor (BMP280)
Seeed Studio Grove - Barometer Sensor (BMP280)
×1
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
2x16 LCD Display
×1

Story

Read more

Code

code for the weather forecaster

C/C++
code for the weather forecaster
#include "project.h"
#include "stdio.h"
#include "stdlib.h"
#include "DHT11.h"
#include "BMP180.h"

int main(void)
{
    CyGlobalIntEnable; /* Enable global interrupts. */

    UART_Start(); /* Start the UART component */
    LCD_Start(); /* Start the LCD component */
    DHT11_Start(); /* Start the DHT11 component */
    BMP180_Start(); /* Start the BMP180 component */
    
    float temperature, humidity, pressure;
    char str[16];
    
    for(;;)
    {
        if(DHT11_GetStatus() == DHT11_READY)
        {
            temperature = DHT11_GetTemperature();
            humidity = DHT11_GetHumidity();
        }
        
        if(BMP180_GetStatus() == BMP180_READY)
        {
            pressure = BMP180_GetPressure();
        }
        
        sprintf(str, "Temp: %.1f C", temperature);
        LCD_Position(0,0);
        LCD_PrintString(str);
        
        sprintf(str, "Humidity: %.1f%%", humidity);
        LCD_Position(1,0);
        LCD_PrintString(str);
        
        sprintf(str, "Pressure: %.1f kPa", pressure/1000);
        UART_PutString(str);
        
        CyDelay(5000);
    }

Credits

Sandeep Dwivedi
10 projects • 27 followers
just a learner curious about things

Comments