当前位置:网站首页>基于OpenHarmony的智能金属探测器
基于OpenHarmony的智能金属探测器
2022-07-05 10:43:00 【InfoQ】
一、简介

二、运行效果

三、功能实现


uint8_t Mpu_Read_Bytes(uint8_t const regAddr, uint8_t *pData, uint8_t len)
Mpu_Data.mag_x = (MPU_BUFF[16] << 8) | MPU_BUFF[15]; // x轴磁场数据
Mpu_Data.mag_y = (MPU_BUFF[18] << 8) | MPU_BUFF[17]; // y轴磁场数据
Mpu_Data.mag_z = (MPU_BUFF[20] << 8) | MPU_BUFF[19]; // z轴磁场数据
Gauss_Mag_z = Mpu_Calc.mag_z * 0.15f * 0.01f;
const uint16_t calibrateCount = 1000; // 测量最大次数为1000
const uint16_t calibrateFrequency = 5; // 每测量5次取一次有效值
const uint16_t calibrateAverageCount = 100; // 取100次有效值
if(i < calibrateCount){
i++;
if(i%calibrateFrequency == calibrateFrequency){
Mag_z_buff[j++] = Gauss_Mag_z;
if(j >= calibrateAverageCount){
i = calibrateCount;
Mag_z_Flag = true;
for(k=0;k<calibrateAverageCount;k++){
origin_mag_z += Mag_z_buff[k];
}
origin_mag_z = origin_mag_z / calibrateAverageCount;
// 校准完成,蓝灯亮,发送给应用端 "CalibrateOK"
BLUE_LED_ON();
memset(buff,0x00,sizeof(buff));
sprintf(buff,"angle:%s","CalibrateOK");
ESP8266_send_data(buff,strlen(buff));
}
}
}
// 先挂载,再send
hdc_std shell mount -oremount,rw /
hdc_std file send libtcpserverapi.z.so system/lib/module/libtcpserverapi.z.so
import tcpserverapi from '@ohos.tcpserverapi'
// 调用initServer接口 初始化 TCP 服务器
tcpserverapi.initServer()
// 调用recvMsg 获取并解析Geek_Lite_Board开发板发送过来的角度
tcpserverapi.recvMsg().then((result) => {
var resultAngle = result.angle;
})


Flex(options?: { direction?: FlexDirection, wrap?: FlexWrap, justifyContent?: FlexAlign, alignItems?: ItemAlign, alignContent?: FlexAlign })
aboutToAppear() {
var intervalID = setInterval(() => {
tcpserverapi.recvMsg().then((result) => {
}
}
}
if (resultMetal.match("metal:")) {
this.metal = resultMetal.slice(6);
console.info('=======' + this.metal)
if (this.metal === 'Detected') {
this.detectionState = '发现金属';
this.detection = $r("app.media.img_detected");
this.isDisplay = false;
}
else if (this.metal === 'UnDetected' || this.metal ==='CalibrateOK') {
this.detectionState = '检测中';
this.detection = $r("app.media.img_detecting");
this.isDisplay = true;
}
}
import media from '@ohos.multimedia.media';
// OH media对象
private player = media.createAudioPlayer();
play():void
四、总结
五、参考链接

边栏推荐
- 磨砺·聚变|知道创宇移动端官网焕新上线,开启数字安全之旅!
- 中职组网络安全2021年江苏省省赛题目5套题目环境+解析全有需要的私信我
- 括号匹配问题(STL)
- Honing · fusion | know that the official website of Chuangyu mobile terminal is newly launched, and start the journey of digital security!
- How can gbase 8C database view the login information of the login user, such as the date, time and IP of the last login authentication?
- Do you really understand the things about "prototype"? [part I]
- 2022鹏城杯web
- [JS] extract the scores in the string, calculate the average score after summarizing, compare with each score, and output
- 一次edu证书站的挖掘
- A usage example that can be compatible with various database transactions
猜你喜欢
关于vray 5.2的使用(自研笔记)
微信核酸检测预约小程序系统毕业设计毕设(7)中期检查报告
Wechat nucleic acid detection appointment applet system graduation design completion (7) Interim inspection report
关于vray 5.2的使用(自研笔记)(二)
go语言学习笔记-初识Go语言
2022 mobile crane driver examination question bank and simulation examination
32:第三章:开发通行证服务:15:浏览器存储介质,简介;(cookie,Session Storage,Local Storage)
DGL中的消息传递相关内容的讲解
How to close the log window in vray5.2
LSTM applied to MNIST dataset classification (compared with CNN)
随机推荐
Solution to the length of flex4 and Flex3 combox drop-down box
【js学习笔记五十四】BFC方式
[JS] extract the scores in the string, calculate the average score after summarizing, compare with each score, and output
Wechat nucleic acid detection appointment applet system graduation design completion (7) Interim inspection report
Web Components
Explanation of message passing in DGL
C语言活期储蓄账户管理系统
TSQL–标示列、GUID 、序列
SQL Server monitoring statistics blocking script information
Applet framework taro
Pull up loading principle
MFC宠物商店信息管理系统
【广告系统】Parameter Server分布式训练
Go project practice - parameter binding, type conversion
[vite] 1371 - develop vite plug-ins by hand
matlab cov函数详解
Do you really understand the things about "prototype"? [part I]
2022年流动式起重机司机考试题库及模拟考试
NAS and San
图片懒加载的方案