暂时不编译day5,lcd显示温度成功
This commit is contained in:
parent
be09a1c768
commit
b846ef98a6
@ -2,9 +2,7 @@ from building import *
|
||||
import os
|
||||
|
||||
cwd = GetCurrentDir()
|
||||
src = [
|
||||
'mqtt.c',
|
||||
]
|
||||
src = [ ]
|
||||
|
||||
CPPPATH = [cwd]
|
||||
|
||||
|
@ -4,3 +4,5 @@
|
||||

|
||||
关了就好了
|
||||

|
||||
### 开了soft rtc
|
||||

|
BIN
dayandnight/image-3.png
Normal file
BIN
dayandnight/image-3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 26 KiB |
@ -38,6 +38,8 @@ char tmp[1026];
|
||||
// Humi:湿度值,Temp:温度值
|
||||
float Humi, Temp;
|
||||
|
||||
void ath_init(void);
|
||||
void mqt_init(void);
|
||||
|
||||
#define EXAMPLE_TRACE(fmt, ...) \
|
||||
do { \
|
||||
@ -104,7 +106,10 @@ static int example_subscribe(void *handle)
|
||||
|
||||
void show_lcd()
|
||||
{
|
||||
lcd_show_string(10, 69 + 16 + 24, 32, tmp);
|
||||
sprintf(tmp, "Temp: %.3f", Temp);
|
||||
lcd_show_string(10, 10, 24, tmp);
|
||||
sprintf(tmp, "Humi: %.3f", Humi);
|
||||
lcd_show_string(10, 10+24, 24, tmp);
|
||||
}
|
||||
|
||||
void make_file()
|
||||
@ -144,12 +149,13 @@ void tmp_payload(void)
|
||||
sprintf(tmp, "Temp: %.1f;Humi: %.1f;Count: %d\n", Temp, Humi,++cnt);
|
||||
// rt_kprintf("\n%f %f tmp:%s\n",Humi,Temp,tmp);
|
||||
make_file();
|
||||
lcd_show_string(10, 69 + 16 + 24, 32, "RT-Thread");
|
||||
show_lcd();
|
||||
sprintf(tmp, "{\"params\":{\"temperature\":%.2f,\"humidity\":%.2f}}", Temp, Humi);
|
||||
return;
|
||||
}
|
||||
void test_lcd()
|
||||
{
|
||||
ath_init();
|
||||
while(1)
|
||||
{
|
||||
tmp_payload();
|
||||
@ -245,9 +251,8 @@ static void mqtt_example_main(void *parameter)
|
||||
|
||||
rt_thread_t MQTT_Thread = RT_NULL;
|
||||
|
||||
void my_project(void)
|
||||
void ath_init(void)
|
||||
{
|
||||
|
||||
// 初始化设备
|
||||
Dev = aht10_init(AHT10_I2C_BUS);
|
||||
if (Dev == RT_NULL)
|
||||
@ -255,7 +260,9 @@ void my_project(void)
|
||||
rt_kprintf("AHT10_init Fail");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
void mqt_init(void)
|
||||
{
|
||||
MQTT_Thread = rt_thread_create("MTQQ_Thread", mqtt_example_main, RT_NULL, THREAD_STACK_SIZE, THREAD_PRIORITY, THREAD_TIMESLICE);
|
||||
|
||||
if (MQTT_Thread != RT_NULL)
|
||||
@ -266,6 +273,12 @@ void my_project(void)
|
||||
{
|
||||
rt_kprintf("MQTT Thread Create Failed!\n");
|
||||
}
|
||||
}
|
||||
void my_project(void)
|
||||
{
|
||||
ath_init();
|
||||
|
||||
mqt_init();
|
||||
|
||||
}
|
||||
MSH_CMD_EXPORT_ALIAS(my_project,myproject, run my project);
|
Loading…
x
Reference in New Issue
Block a user