📅  最后修改于: 2022-03-11 14:57:40.894000             🧑  作者: Mango
let sensor = new Magnetometer();
sensor.start();
let heading = Math.atan2(sensor.y, sensor.x) * (180 / Math.PI);
console.log('Heading in degrees: ' + heading);