W80X IOT SDK 开源 LVGL 简易天气时钟心知天气 API

发布于 2025-01-21 21: 25: 47

开发板和 LCD 接线

GPIO_NUM Pin Number Connection Description LCD PIN
WM_GPIO_NUM_22 PB6 CLK 11
WM_GPIO_NUM_23 PB7 MOSI 13
WM_GPIO_NUM_27 PB11 CS 9
WM_GPIO_NUM_26 PB10 RESET 15
WM_GPIO_NUM_32 PB16 LED 36
WM_GPIO_NUM_25 PB9 DCX 10

默认 WIFI 账号密码配置--- main/src/user_clock. c

#ifndef CONFIG_EXAMPLE_WIFI_SSID
#define CONFIG_EXAMPLE_WIFI_SSID "w600"
#endif

#ifndef CONFIG_EXAMPLE_WIFI_PASSWORD
#define CONFIG_EXAMPLE_WIFI_PASSWORD "12345678"
#endif

可以自己申请天气 API Url 配置 (心知天气 API 使用手册)

// ---  main/src/user_weather. c
int wm_example_httpc_set_content_type (void) 
{
    wm_http_client_config_t cfg = { 0 }; 

    cfg. method        = WM_HTTP_CLIENT_REQUEST_TYPE_GET; 
    cfg. keep_alive    = 1; 
    cfg. content_type  = WM_HTTP_CLIENT_CONTENT_APPLICATION_JSON; 
    cfg. event_handler = wm_httpc_event_handle; 

    return wm_httpc_example_send_req (&cfg,  "https: //api. seniverse. com/v3/weather/daily. json? key=SoN6W4qEok02ndiXO&location=ip&language=zh-Hans&unit=c&start=0&days=3",  NULL,  0) ; 
}

W801S: help

COMMAND LIST: 
cls                   -- clear command line
help                  -- show help info
log                   -- log level cmd
heap                  -- show heap tracing
free                  -- show free heap size
task                  -- show task list
reboot                -- reboot system
version               -- show sdk version info
partition             -- partition table cmd

用到的 1. 69 寸 240*280 LCD 液晶屏模块: 淘宝链接

实拍效果

weather. png

视频链接: https: //v. douyin. com/ifBBtGfK/

需要将压缩包中components新增的 lcd 驱动替换到IoT SDK/components对应文件目录

代码打包下载: 简易天气时钟. zip

0 条评论

发布
问题