U6 Code Question

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!