陀螺仪
最后更新于:2022-04-02 03:38:32
[TOC]
> [参考](https://uniapp.dcloud.net.cn/api/system/gyroscope)
## 概述
实例
```
export default {
methods: {
start() {
uni.onGyroscopeChange((res) => {
console.log('gyroData.rotationRate.x = ' + res.x)
console.log('gyroData.rotationRate.y = ' + res.y)
console.log('gyroData.rotationRate.z = ' + res.z)
});
uni.startGyroscope({
interval: "normal",
success() {
console.log('success')
},
fail() {
console.log('fail')
}
})
},
stop(){
uni.stopGyroscope({
success() {
console.log('stop success!')
},
fail() {
console.log('stop fail!')
}
})
}
}
}
```
';