只需一步,快速开始
微信扫一扫,快速登录
默认版
举报
yptsai7 发表于 2025-6-7 19:13 请问有支持ESP32(4MB)的小智AI?谢谢。
yptsai7 发表于 2025-6-9 09:25 请问可有播放WS2812的例子?谢谢。
yptsai7 发表于 2025-6-12 20:55 由于积木中没有命令为字串?我简单写个测试,部分码如下: void handleIotControl(const std::string& name ...
本版积分规则 发表回复 回帖并转播 回帖后跳转到最后一页
管理员
2025-5-29
2025-5-22
2025-3-14
社区共建 资源共享
举报
举报
仅支持s3
举报
点评
举报
由于积木中没有命令为字串?我简单写个测试,部分码如下:
void handleIotControl(const std::string& name, const std::string& function,
const std::map<std::string, ai_vox::iot::Value>& params) {
if (name == "strip") {
if (function == "Setstate") {
std::string color_str = std::get<std::string>(params.at("color"));
if (color_str.find("红色") != std::string::npos) {
strip.setLedColorData(0,0xFF0000);
} else if (color_str.find("绿色") != std::string::npos) {
strip.setLedColorData(0,0x00FF00);
} else if (color_str.find("蓝色") != std::string::npos) {
strip.setLedColorData(0,0x0000FF);
} else {
// 處理 HEX 顏色碼
}
strip.show();
g_strip_entity->UpdateState("state",color_str);
}
}
}
void setupIotDevices() {
{
std::vector<ai_vox::iot::Property> strip_props{
{"state", "灯条的颜色", ai_vox::iot::ValueType::kString}
};
std::vector<ai_vox::iot::Function> strip_funcs{
{"Setstate", "设置灯条的颜色", {
{"color", "设置灯条的颜色", ai_vox::iot::ValueType::kString}
}}
};
g_strip_entity = std::make_shared<ai_vox::iot::Entity>("strip", "灯条的颜色", strip_props, strip_funcs);
g_strip_entity->UpdateState("state", "");
g_ai_vox->registerIotDevice(g_strip_entity);
}
}
举报
在做这个库
举报