Accellerometer monitor
Hallo, my name is Stefano
I'm new to this nice tool, so be patient if I'm doing a very stupid mistake.
Following the sample in the online documentation I'm trying to do something when the device move.
I'm expecting to see "movement" in the debug log when the board moves whit more than 0,5f. But nothing happen.
Thanks in advance.
This is the part of the code I'm using:
public void connected() {
Log.i(LOG_TAG, "Connected");
try {
accelModule= mwBoard.getModule(Accelerometer.class);
accelModule.setOutputDataRate(50f); ///< Set operating freq to 50Hz
accelModule.routeData().fromAxes()
.process(new Accumulator())
.process(new Threshold(0.5f, Threshold.OutputMode.BINARY))
.split()
.branch().process(new Comparison(Comparison.Operation.EQ, 1))
.monitor(new DataSignal.ActivityHandler() {
@Override
public void onSignalActive(Map<String, DataProcessor> processors, DataSignal.DataToken token) {
Log.e(LOG_TAG, "movement");
}
})
.end()
.commit()
catch (UnsupportedModuleException e) {
Log.e(LOG_TAG, "Cannot find module", e);
}
}
@Override
public void disconnected() {
Log.i(LOG_TAG, "Disconnected");
}
});
mwBoard.connect();
}
This discussion has been closed.
Comments