Funpack第十二期-基于 Wio Terminal 自动联网的天气预报仪
基于 Wio Terminal 自动联网的天气预报仪 最近三天的天气预报
标签
嵌入式系统
吴童鞋
更新2022-01-10
742
开发板介绍
Wio Terminal 是基于SAMD51的微控制器,具有 Realtek RTL8720DN 支持的无线连接,与Arduino和MicroPython兼容。
它的运行速度为 120MHz (最高可达200MHz), 4MB 外部闪存和 192K
它同时支持蓝牙和Wi-Fi,为物联网项目提供了骨架。Wio Terminal自身配有 a 2.4” LCD屏幕, 板载IMU(LIS3DHTR),麦克风,蜂鸣器,microSD卡槽,光传感器和红外发射器(IR 940nm)。
 
 
任务介绍
制作一个自动联网的天气预报仪,在设计界面显示温湿度、天气情况、空气质量以及未来三天内的天气变化。
 
依赖库:
Seeed_Arduino_rpcWiFi - search for "seeed rpcwifi"

Seeed_Arduino_rpcUnified - search for "seeed rpcunified"

Seeed_Arduino_mbedtls - search for "seeed mbedtls"

Seeed_Arduino_FS - search for "seeed fs"

Seeed_Arduino_SFUD - search for "seeed sfud"

需要特别注意 需要先升级wifi库 ,执行以下步骤:Overview - Seeed Wiki (seeedstudio.com)

cd ~
git clone https://github.com/Seeed-Studio/ambd_flash_tool
cd ambd_flash_tool
\ambd_flash_tool.exe erase
\ambd_flash_tool.exe flash

核心代码

  • wifi链接
  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(1000);
  }
  • 布局显示
 tft.setFreeFont(FMBO9);
  tft.setTextSize(1);
  tft.setTextColor(TFT_WHITE);
  tft.fillScreen(TFT_BLUE);
  tft.drawString(location, 10, 10);

  tft.drawString(temperature + "°C", 10 +10+ tft.textWidth(location), 10);
  tft.drawString(humidity , 10 + 20+ tft.textWidth(location)+tft.textWidth(temperature + "°C"), 10);
  tft.drawString(air , 10 + 20+10+ tft.textWidth(location)+tft.textWidth(temperature + "°C")+ tft.textWidth(humidity), 10);

  tft.drawFastHLine(10, 33, 300 , TFT_GREEN);
  tft.drawFastHLine(10, 34, 300 , TFT_GREEN);
  tft.drawFastHLine(10, 35, 300 , TFT_GREEN);

  const int Margin = 20;
  const int Width = (320 - 4 * Margin) / 3;

  Draw_icon(today_code, Margin * 1 +10 , Width -10);
  tft.setFreeFont(FMB9);
  Center_String("Today", Margin * 1 ,  120, Width);
  Center_String(today_temperature + "°C", Margin * 1 ,  160, Width);
  Center_String(today_weather_text, Margin * 1,  200, Width);

  Draw_icon(tomorrow_code, Margin * 2 + Width+10 , Width-10);
  tft.setFreeFont(FMB9);
  Center_String("Tomorrow", Margin * 2 + Width ,  120, Width);
  Center_String(tomorrow_temperature + "°C", Margin * 2 + Width ,  160, Width);
  Center_String(tomorrow_weather_text, Margin * 2 + Width ,  200, Width);

  Draw_icon( tdat_code, Margin * 3 + Width * 2+10, Width-10);
  tft.setFreeFont(FMB9);
  Center_String("Other Day", Margin * 3 + Width * 2,  120, Width);
  Center_String(tdat_temperature + "°C", Margin * 3 + Width * 2,  160, Width);
  Center_String(tdat_weather_text, Margin * 3 + Width * 2,  200, Width);
显示展示
  • 连接wifi
FtIKYuNs9vqFKB8QkyU7UPCUlfq8
  •  显示数据
Fv9y9ga8Q8VRcZlofP8Ss9BEvxmu

活动感受

非常好的活动  花了挺多时间来研究  收获很大

附件下载
weather_demo.zip
团队介绍
喜欢嵌入式的吴童鞋
评论
0 / 100
查看更多
目录
硬禾服务号
关注最新动态
0512-67862536
info@eetree.cn
江苏省苏州市苏州工业园区新平街388号腾飞创新园A2幢815室
苏州硬禾信息科技有限公司
Copyright © 2023 苏州硬禾信息科技有限公司 All Rights Reserved 苏ICP备19040198号