I have a ConnectIQ app which reads from a bike speed/cadence sensor on Edge520plus, and on Edge830 simulator, but not in on real Edge830. I have tried using ANT plus, and also the sensor object. Stranger still, it works on Edge830 if I swap the BIKESPEED sensor for BIKEPOWER.
I have posted this as a question on the discussion forum, but received no answer.
Here is my simplified code, modified from Sensor example. I have all permissions enabled, just in case..
using Toybox.WatchUi;
using Toybox.Graphics;
using Toybox.System as Sys;
using Toybox.Lang;
using Toybox.Time.Gregorian;
using Toybox.Sensor;
using Toybox.Application;
using Toybox.Position;
class SensorTester extends WatchUi.View
{
var string_SPD;
var SPD_graph;
//! Constructor
function initialize()
{
View.initialize();
Sensor.setEnabledSensors( [Sensor.SENSOR_BIKESPEED] );
Sensor.enableSensorEvents( method(:onSnsr) );
string_SPD= "---kph";
}
//! Handle the update event
function onUpdate(dc)
{
dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_BLACK);
dc.clear();
dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_TRANSPARENT );
dc.drawText(dc.getWidth() / 2, 90, Graphics.FONT_LARGE, string_SPD, Graphics.TEXT_JUSTIFY_CENTER);
}
function onSnsr(sensor_info)
{
var SPD = sensor_info.speed;
if( SPD != null )
{
Sys.println("Spd = " + SPD.toString());
string_SPD = SPD.toString() + "kph";
}
else
{
string_SPD = "---kph";
Sys.println("SPD = null");
}
WatchUi.requestUpdate();
}
}
//! main is the primary start point for a Monkeybrains application
class SensorTest extends Application.AppBase
{
function initialize() {
AppBase.initialize();
}
function onStart(state)
{
return false;
}
function getInitialView()
{
return [new SensorTester()];
}
function onStop(state)
{
return false;
}
}