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

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

开发板和LCD接线

GPIO_NUMPin NumberConnection DescriptionLCD PIN
WM_GPIO_NUM_22PB6CLK11
WM_GPIO_NUM_23PB7MOSI13
WM_GPIO_NUM_27PB11CS9
WM_GPIO_NUM_26PB10RESET15
WM_GPIO_NUM_32PB16LED36
WM_GPIO_NUM_25PB9DCX10

默认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 条评论

发布
问题