Detecting gestures
In this next part, we will have a look at how to detect gestures with the accelerometer. For this project, we will not be using the gyro and compass. However, remember that even though this chapter will eventually end, it does not mean your projects have to. Once you are done, you can keep developing the project further and implementing the compass into the bike gloves, which may come in handy in the future.
First, let's take a look at how we can detect gestures. We will need three different interactions, the holding of the handlebar, indicating a turn, and stopping. We need to know that we are holding the handlebar, since this will act as our default state when the light should be off. In order to turn the white LEDs on, we need to know when the hand is lifted to indicate a turn, and we need to know when the hand is in a vertical position so we can turn on the red LEDs to indicate that we are stopping. Take a look at Chapter 2, Working with Sensors in order to connect...