中秋节的名称来源于古代历法。
农历八月十五日位于秋季之中,因此被称为“中秋”。
古代中国人将一年分为四个季节,
每个季节又分为“孟、仲、季”三个月份,
八月正好是秋季的第二个月,即“仲秋”.
今天分享一个行空板K10中秋海报
————显示中秋快乐、温度、湿度、日期和时间。
一、认识行空板K10屏幕
1. 行空板K10屏幕分辨率240*320
2.屏幕显示大小有两种,24*24 和 16*16种
3.清除屏幕文字指令有13行
以屏幕显示文字24*24的内容,x轴坐标对应表
二、编写程序
1.显示文字自动清除关闭
2.画矩形不填充
步骤1 打开mind+ V1.8.1 RC1.0,数据线连接K10,在连接com17 K10
步骤2 点击左下角扩展,选择行空板K10、WiFi、NTP
步骤3 设计程序
代码
/*!
* MindPlus
* esp32s3bit
*
*/
#include <DFRobot_Iot.h>
#include "unihiker_k10.h"
#include <MPython_NtpTime.h>
#include "arduino_image_cache.h"
// 创建对象
DFRobot_Iot myIot;
UNIHIKER_K10 k10;
uint8_t screen_dir=2;
MPython_NtpTime ntptime;
AHT20 aht20;
// 主程序开始
void setup() {
k10.begin();
k10.initScreen(screen_dir);
k10.creatCanvas();
myIot.wifiConnect("TP-LINK_kang", "Rzeg@126.com");
while (!myIot.wifiStatus()) {
k10.rgb->write(-1, 0x009900);
}
delay(1000);
k10.canvas->canvasClear();
k10.rgb->write(-1, 0x000000);
ntptime.setNtpTime(ntptime.UTCEast8_t, "edu.ntp.org.cn");
k10.canvas->canvasSetLineWidth(5);
k10.canvas->canvasRectangle(10, 5, 220, 170, 0x000000, 0xFFFFFF, false);
k10.canvas->canvasText((String(ntptime.localTime(ntptime.Year)) + String((String("年") + String((String(ntptime.localTime(ntptime.Month)) + String((String("月") + String((String(ntptime.localTime(ntptime.Date)) + String("日")))))))))), 22, 285, 0x333333, k10.canvas->eCNAndENFont24, 50, false);
k10.canvas->canvasDrawBitmap(50,15,143,151,image_data1);
}
void loop() {
k10.canvas->canvasClear(9);
k10.canvas->canvasText((String("湿度:") + String(aht20.getData(AHT20::eAHT20HumiRH))), 22, 195, 0x333333, k10.canvas->eCNAndENFont24, 50, false);
k10.canvas->canvasClear(10);
k10.canvas->canvasText((String("温度:") + String(aht20.getData(AHT20::eAHT20TempC))), 22, 220, 0x333333, k10.canvas->eCNAndENFont24, 50, false);
k10.canvas->canvasClear(11);
k10.canvas->canvasText((String("时间:") + String((String(ntptime.localTime(ntptime.Hour)) + String((String(":") + String(ntptime.localTime(ntptime.Minute))))))), 22, 248, 0x333333, k10.canvas->eCNAndENFont24, 50, false);
k10.canvas->updateCanvas();
delay(1000);
}
评论