项目实践案例征集K10-六年级第25课 安全带未系提醒
本帖最后由 Isabella_J 于 2025-2-20 18:34 编辑代码
/*!
* MindPlus
* esp32s3bit
*
*/
#include "unihiker_k10.h"
#include "arduino_image_cache.h"
// 创建对象
UNIHIKER_K10 k10;
uint8_t screen_dir=2;
Music music;
// 主程序开始
void setup() {
k10.begin();
k10.initScreen(screen_dir);
k10.creatCanvas();
}
void loop() {
// 模拟座位有人
if ((k10.buttonA->isPressed())) {
// 模拟系好安全带
if ((k10.buttonB->isPressed())) {
k10.canvas->canvasClear();
music.stopPlayTone();
}
else {
k10.setScreenBackground(0xFFFFFF);
music.playMusic(BA_DING);
k10.canvas->canvasText("请系好安全带", 50, 50, 0xFF0000, k10.canvas->eCNAndENFont24, 50, true);
k10.canvas->canvasDrawBitmap(0,100,240,240,image_data1);
k10.canvas->updateCanvas();
}
}
else {
k10.canvas->canvasClear();
music.stopPlayTone();
}
}
https://www.bilibili.com/video/BV1K2NBe9EHV/
页:
[1]