on Gesture
Run some code when you perform a gesture, like shaking the Adafruit Circuit Playground Express.
input.onGesture(Gesture.Shake,() => {
})
Parameters
gesture
: the gesture to detect. A gesture is the way you hold or move the Adafruit Circuit Playground Express. Gestures are:shake
: shake the boardlogo up
: the logo is facing uplogo down
: the logo is facing downscreen up
: the screen side is upscreen down
: the screen side is downtilt left
: the board is tilted to the lefttilt right
: the board is tilted to the rightfree fall
: the board is falling for a distance2g
: acceleration force of 2 g (works well for step detection)3g
: acceleration force of 3 g6g
: acceleration force of 6 g
body
: code to run when the gesture event occurs
Example: random number
Log a message when you shake the Adafruit Circuit Playground Express.
input.onGesture(Gesture.Shake, function() {}
console.log("I'm shaking!")
})
accelerometer