Hey,
I followed the documentation provided by you and made
all the changes. But now, when I start scanning the accelerometer data, I
am getting a NullPointerException saying the accelerometer module is
null.
Can you tell me how do I rectify this?
Thanks,
Deepak
Comments
Thanks,
Deepak
public void onServiceConnected(ComponentName name, IBinder service) {
Log.i("Service", "Connected");
serviceBinder = (MetaWearBleService.LocalBinder) service;
mwBoard= serviceBinder.getMetaWearBoard(MW_Board);
if (mwBoard != null) {
try {
accelCtrllr = mwBoard.getModule(Accelerometer.class);
// Set the sampling frequency to 100Hz, or closest valid ODR
accelCtrllr.setOutputDataRate(100.f);
// Set the measurement range to +/- 8g, or closet valid range
accelCtrllr.setAxisSamplingRange(8.f);
// enable axis sampling
accelCtrllr.enableAxisSampling();
....
I made some changes to my code and made it in this way:
if (mwBoard.isConnected()) {andaccelCtrllr.start();
}
else{
Log.i("mwBoard", "Not Connected");
}
public void onServiceConnected(ComponentName name, IBinder service) {
Log.i("Service", "Connected");
serviceBinder = (MetaWearBleService.LocalBinder)service;
mwBoard=serviceBinder.getMetaWearBoard(MW_Board);
mwBoard.connect();
if (mwBoard.isConnected()) {
try {
accelCtrllr = mwBoard.getModule(Accelerometer.class);
....
Even now I am getting the same issue.
I am getting a NullPointerException at
accelCtrllr.start();