For the life of me I can’t figure this out, I assume I’m overthinking it.
How can I code the app lab to react to the board shaking, like the board shakes and the lights turn on, the person stops shaking and the lights turn off.
For the life of me I can’t figure this out, I assume I’m overthinking it.
How can I code the app lab to react to the board shaking, like the board shakes and the lights turn on, the person stops shaking and the lights turn off.
You can use an event listener to detect shaking.
Here’s the documentation on the accelerometer itself:
Here’s a little more information on accelerometer events:
Is this what you were after?
Unit 6 of CSD has a lesson (lesson 12) on accelerometers that may also help.
If you still need assistance, please check back in!
Mike
I have this same question and I already checked both the resources available about the accelerometer and accelerometer events.
My students are currently working on the interactive artwork project and had the same question. We can use an onboard event to using the accelerometer event to detect when it is shaking. They have it programmed to light up when someone shakes it. We can’t figure out how to get it to turn off the LEDs when someone stops shaking it.
What about using the change event… then, it will only react when there is a change as opposed to all the time …
Here’s a writeup on that. Change Events
Mike