Hi! Im quite new user with Arduino and its programming and now I have exactly the same problem with the Nicla Sense and want to read accelerometer values with Data Ready Interrupt function. I saw answer from BSTRobin: "You could get ODR by calling bhy2_get_virt_sensor_cfg();" But how should the bhy2_get_virt_sensor_cfg(); be added into the code below ? Should there be something more specific with it? #include "Arduino_BHY2.h"
SensorXYZ accel(SENSOR_ID_ACC); // Accelerometer corrected
void setup(){
Serial.begin(115200);
BHY2.begin();
accel.begin(1000, 0); // sample-rate = 1000Hz, latency = 0ms (similar to Data-Ready Interrupt functionality)
}
void loop(){
static auto printTime = micros();
// Update function should be continuously polled
BHY2.update();
if (get_interrupt_status()) { // new data every 1ms (1000Hz)???
printTime = micros();
Serial.println(String("acceleration: ") + accel.toString());
}
} I really appreciate your help 🙂
... View more