当前位置:网站首页>基于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
四、总结
五、参考链接

边栏推荐
- 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?
- Cross page communication
- 2021年山东省赛题库题目抓包
- 九度 1480:最大上升子序列和(动态规划思想求最值)
- Sqlserver regularly backup database and regularly kill database deadlock solution
- LSTM应用于MNIST数据集分类(与CNN做对比)
- [vite] 1371 - develop vite plug-ins by hand
- 【JS】提取字符串中的分数,汇总后算出平均分,并与每个分数比较,输出
- Nuxt//
- 【广告系统】Parameter Server分布式训练
猜你喜欢

Explanation of message passing in DGL

LSTM applied to MNIST dataset classification (compared with CNN)

Crawler (9) - scrape framework (1) | scrape asynchronous web crawler framework

微信核酸检测预约小程序系统毕业设计毕设(7)中期检查报告

磨砺·聚变|知道创宇移动端官网焕新上线,开启数字安全之旅!

9、 Disk management

Web3基金会「Grant计划」赋能开发者,盘点四大成功项目

About the use of Vray 5.2 (self research notes)

DGL中异构图的一些理解以及异构图卷积HeteroGraphConv的用法

Review the whole process of the 5th Polkadot Hackathon entrepreneurship competition, and uncover the secrets of the winning projects!
随机推荐
websocket
图片懒加载的方案
Solution to the length of flex4 and Flex3 combox drop-down box
2022年危险化学品经营单位主要负责人特种作业证考试题库及答案
32:第三章:开发通行证服务:15:浏览器存储介质,简介;(cookie,Session Storage,Local Storage)
Data type
修复动漫1K变8K
Use bat command to launch common browsers with one click
[可能没有默认的字体]Warning: imagettfbbox() [function.imagettfbbox]: Invalid font filename……
dsPIC33EP 时钟初始化程序
Buried point 111
函数///
风控模型启用前的最后一道工序,80%的童鞋在这都踩坑
matlab cov函数详解
【DNS】“Can‘t resolve host“ as non-root user, but works fine as root
Go project practice - Gorm format time field
Applet framework taro
Node の MongoDB Driver
C#实现获取DevExpress中GridView表格进行过滤或排序后的数据
flex4 和 flex3 combox 下拉框长度的解决办法