Hi Guys, I am trying to read heartrate data from Android with below code snippet, but its not working. Heartrate sensor light is not switching ON, any help would be grateful.
private final AsyncOperation.CompletionHandler<RouteManager> gpioHandler = new AsyncOperation.CompletionHandler<RouteManager>() { @Override public void success(RouteManager result) { result.subscribe(HEART_RATE, dataHandler); try { AsyncOperation<Timer.Controller> taskResult = mwBoard.getModule(Timer.class).scheduleTask( new Timer.Task() { @Override public void commands() { gpio.readAnalogIn(GPIO_PIN, Gpio.AnalogReadMode.ADC); } }, 5000, false); taskResult.onComplete( new AsyncOperation.CompletionHandler<Timer.Controller>() { @Override public void success(Timer.Controller result) { result.start(); } } ); } catch (UnsupportedModuleException e) { Log.e("HeartRateSensorFragment", e.toString()); } }
};
private final RouteManager.MessageHandler dataHandler = new RouteManager.MessageHandler() { @Override public void process(Message message) { short rawValue = message.getData(Short.class); Log.i(TAG, "!raw data from heart rate sensor: " + String.valueOf(rawValue)); } };
Comments