Hello,
I am trying to write my first application for my fenix3HR in order to practice programming and creating an application that produces my HRV is of interest. I have experience in Matlab programming, but this is my first time outside that environment. I have read the documentation and tutorials posted on here but I still have some confusion still on how to access and store sensor data of interest.
I am using a modified "sample" code "SimpleDataField" to get me started and I have referenced these links to assist me (API-Doc , GITHUB). Here is what I have so far;
view.mc
using Toybox.WatchUi;
using Toybox.System;
using Toybox.Time;
using Toybox.Sensor;
class DataField extends WatchUi.SimpleDataField {
var heartBeatIntervals = [];
// Constructor
function initialize() {
SimpleDataField.initialize();
label = "HR";
counter = 0;
}
function compute(sensorData) {
if (sensorData has :heartRateData && sensorData.heartRateData != null) {
heartBeatIntervals = sensorData.heartRateData.heartBeatIntervals;
}
return heartBeatIntervals;
}
}
app.mc
using Toybox.Application;
class SimpleDataField extends Application.AppBase {
function initialize() {
AppBase.initialize();
}
function onStart(state) {
return false;
}
function getInitialView() {
return [new DataField()];
}
function onStop(state) {
return false;
}
}
I would appreciate any insight. Thank you.