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 條評論

發布
問題