turn on samples when reading accelerometer (#2413)

This commit is contained in:
Peli de Halleux 2019-09-03 13:23:45 -07:00 committed by GitHub
parent 2f3c1ff628
commit 2c85f91489
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -199,6 +199,8 @@ namespace input {
//% parts="accelerometer" //% parts="accelerometer"
//% gesture.fieldEditor="gestures" gesture.fieldOptions.columns=4 //% gesture.fieldEditor="gestures" gesture.fieldOptions.columns=4
bool isGesture(Gesture gesture) { bool isGesture(Gesture gesture) {
// turn on acceleration
uBit.accelerometer.getX();
int gi = (int)gesture; int gi = (int)gesture;
return uBit.accelerometer.getGesture() == gi; return uBit.accelerometer.getGesture() == gi;
} }