Hi bgfas,
1. Previous code I provided had some mistake. Now you could use the following code to print sensor ID list.
/* get virtual sensor information from sensor hub */ Serial.println("Supported Virtual Sensor Information:\n"); Serial.println("Supported Virtual Sensor Information:"); Serial.println("-wakeup-"); for(int i = 1; i < 32; i++) { bhi160.getSensorInformation((bhyVirtualSensor)i, true, &information);
if(information.type == (i + BHY_SID_WAKEUP_OFFSET)){ Serial.print("id="); Serial.println(i); } }
Serial.println("-non-wakeup-"); for(int i = 1; i < 32; i++) { bhi160.getSensorInformation((bhyVirtualSensor)i, false, &information);
if(information.type == i){ Serial.print("id="); Serial.println(i); }
}
2. Your previous code that use API to install and config ACC sensor ID is correct. But as the API return failed value, could you check where there is an error return in the function? bhi160.installSensorCallback(BHY_VS_ACCELEROMETER, true, accelerometerHandler); bhi160.configVirtualSensor(BHY_VS_ACCELEROMETER, true, BHY_FLUSH_ALL, 25, 0, 0, 0);
... View more