Home > other >  STM32 use DHT11 temperature and humidity on the LCD display has been collected 00
STM32 use DHT11 temperature and humidity on the LCD display has been collected 00

Time:10-04


Void data_pros ()//electricity at the beginning, behind the temperature will be displayed 00, behind the humidity display: 8, and then collected data, the two have been
{
U8 temp.
U8 humi.
U8 temp_buf [3].
U8 humi_buf [3].

DHT11_Read_Data (& amp; Temp. & amp; Humi);
Temp_buf [0]=10 + 0 x30 temp/;
Temp_buf [1]=temp % 10 + 0 x30;
Temp_buf [2]='\ 0';
Show_Str (60, 25, RED, YELLOW, temp_buf, 24, 1);


Humi_buf [0]=10 + 0 x30 humi/;
Humi_buf [1]=10 + 0 x30 humi %;
Humi_buf [2]='\ 0';
Show_Str (50, 60, YELLOW, YELLOW, humi_buf, 24, 1);

}
Int main (void)
{
u8 i;
SystemInit ();
Delay_init (72);
LCD_Init ();
LCD_Clear (BLACK);
DHT11_Init ();
POINT_COLOR=WHITE;

,0,128 LCD_DrawRectangle (0-1128-1);

Show_Str (32, 5, BLUE, YELLOW, "system monitor", 16, 0).

Show_Str (5, 25, RED, YELLOW, "C" temperature, 24, 1);

Show_Str (5, 50, YELLOW, YELLOW, humidity %, 24, 1);

While (1)
{
i++;
If (I % 20==0)
{
Data_pros ();
}
delay_ms(10);
}

}

CodePudding user response:

Step by step adjustment, line temp_buff see if sensor there is the problem of calculation of 0 or middle finally see you the problem of display

CodePudding user response:

CodePudding user response:

The simulation step by step, look at that step out of the question,

CodePudding user response:

The first step, you have to see you have collected temperature? Whether you collected temperature operating your definition of value,
The second step, check your display program, is to display 00 0, or shown on the 10 0, behind the temperature of 0, you don't have to zero out of ten!
  • Related