Hello good people,
I want to collect raw data from Garmin Smartwatch, such as heart rate, Accelerometer, Gyroscope, SP02, etc., with a high sampling rate of 50 samples per second in a file (fit or csv). I am trying to build an app using the SDK in Visual Studio and using Monkey C. Now, I have some questions:
1. I did see that the fit files can do so to store the data. Will I see the data with the corresponding timestamp in the fit files? I tried to create a field. However, only one value is shown in the created field, and no other values are shown with time.
2. Can I log the data using sensorLogger and save it in a CSV using the SDK? If possible, what is the storage size for the smartwatch to store these files?
3. What is the difference between Sensor Logger and .fit files?
4. Which Garmin watch supports this high sampling data to be stored and used later.
A sample code is attached below which successfully logs the heart rate but still needs development. I want to know which direction I should go to achieve my goal. Any help is appreciated.
import Toybox.Graphics; import Toybox.WatchUi; import Toybox.Sensor; import Toybox.System; class RLView extends WatchUi.View { private var heartRate = null; function initialize() { View.initialize(); Sensor.setEnabledSensors([Sensor.SENSOR_HEARTRATE]); Sensor.enableSensorEvents(method(:onSensor)); } function onLayout(dc as Dc) as Void { setLayout(Rez.Layouts.MainLayout(dc)); } function onShow() as Void { Sensor.enableSensorEvents(method(:onSensor)); } function onUpdate(dc as Dc) as Void { View.onUpdate(dc); dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_BLACK); // Display the heart rate if (heartRate != null) { dc.drawText(10, 20, Graphics.FONT_MEDIUM, "Heart Rate: " + heartRate, Graphics.TEXT_JUSTIFY_LEFT); } else { dc.drawText(10, 20, Graphics.FONT_MEDIUM, "Heart Rate: N/A", Graphics.TEXT_JUSTIFY_LEFT); } function onSensor(sensorInfo as Toybox.Sensor.Info) as Void { System.println("Sensor callback triggered."); if (sensorInfo != null) { System.println("Sensor info is not null."); // Check for heart rate data if (sensorInfo.heartRate != null) { heartRate = sensorInfo.heartRate; System.println("Heart Rate: " + heartRate); } else { System.println("Heart rate data is null."); } WatchUi.requestUpdate(); } function onHide() as Void { Sensor.unregisterSensorDataListener(); } }
Thank you in advance for your time and help!