📅  最后修改于: 2022-03-11 15:00:12.978000             🧑  作者: Mango
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);