02-26-2020 10:56
02-26-2020 10:56
First question simply is there any way to access the raw data from the green LED or are we restricted to the already coded "HR" function? Is there no way to get to a deeper level?
Secondly, I am totally new and useless. Could someone be a hero and tell me how to combine these two functions to set up a recorder and rather than send to console record that data to a text file instead.
I know this is how to set up the sensor to record. But rather than "console.log" I want it to be saved as a text file. Well .CSV ideally but doesn't really matter. Effectively a text file of the console log with time stamp and then data for this sensor. Then after recording data I can extract the file and do whatever stats/manipulation I want.
Hope someone can answer - i am a total novice so apologise for asking a bad question.
Thanks!!!
import { Accelerometer } from "accelerometer"; if (Accelerometer) { // sampling at 1Hz (once per second) const accel = new Accelerometer({ frequency: 1 }); accel.addEventListener("reading", () => { console.log( `ts: ${accel.timestamp}, \ x: ${accel.x}, \ y: ${accel.y}, \ z: ${accel.z}` ); }); accel.start(); }
02-26-2020 11:39
02-26-2020 11:39
At the moment, there's no way to get raw LED data from the API.
Getting sensor data into an accessible file is tricky. The broad outline is:
I've roughly got this working for heart-rate data in near real time. Accelerometer data could pose an additional challenge because it can potentially accumulate much more rapidly, requiring faster comms (unless you don't want much of it).