Hi with the body battery history code example, how do I send the out to a label on the watch face instead of the console?
This code compiles but doesn't work. Device is Venu Sq, which does have body battery and correct API level.
using Toybox.SensorHistory;
using Toybox.System;
// Create a method to get the SensorHistoryIterator object
function getIterator() {
// Check device for SensorHistory compatibility
if ((Toybox has :SensorHistory) && (Toybox.SensorHistory has :getBodyBatteryHistory)) {
// Set up the method with parameters
return Toybox.SensorHistory.getBodyBatteryHistory({});
}
return null;
// get the body battery iterator object
var bbIterator = getIterator();
var sample = bbIterator.next(); // get the body battery data
var localLabel = View.findDrawableById("localLabel");
while (sample != null) {
localLabel.setText(sample.format()); //replace System.println("Sample "+sample.data)
sample = bbIterator.next();
}
}
