Hye everyone,
I would like to have access to sensor in a widget,
So far I've get the Heading and the Elevation easily (from internal one)
but I cannot get pressure and temperature (like other widgets do).
here is my code:
function onShow() {
timer = new Timer.Timer();
timer.start(method(:timerCallback), 250, true);
}
function timerCallback() {
Ui.requestUpdate();
}
function onUpdate(dc) {
var SensInfo = Sensor.getInfo();
heading = SensInfo.heading;
speed = SensInfo.speed;
alt = SensInfo.altitude;
press = SensInfo.pressure;
temp = SensInfo.temperature;
}
Do I need to use SensorHistory?
I can't use direct Sensor Data on Widget?
Many thanks.
Ps I either tried:
Sensor.setEnabledSensors([Sensor.SENSOR_TEMPERATURE]);
Sensor.enableSensorEvents( method(:onSnsr) );