📜  查找东西南北磁力计传感器 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:12.978000             🧑  作者: Mango

代码示例1
let sensor = new Magnetometer();
sensor.start();

/* Calculation of North  */
let heading = Math.atan2(sensor.y, sensor.x) * (180 / Math.PI);
console.log('Heading in degrees: ' + heading);