book collections email follower instructable user

Step 6: Setting Up the Code: Ball and Headband

Picture of Setting Up the Code: Ball and Headband

The Codes that drive the setup may be a tad overwhelming for beginners, trust us, we felt this way too at first. Fortunately we have uploaded the final debugged version here for your convenience, so you don't have to split hairs.

The Code is split into two:

The first is the Ball. The Ball acts as the server and therefore needs to be the one that sets up the Access Point. Once connected the ball will continue to scan for messages from the headbands as to whether it is in hand so it can start the timer. The chip then initiates the timer by blinking out the LEDs separately. That's about it.

The second code is for the Headbands. Each headband connects to the ball as a client with a distinct ID. It sends signals to the ball about when it the ball is in the hand of the user with the corresponding headband and acts accordingly.

When uploading the circuit and during a trial run, you may pull up the Serial Monitor to check out the response when a magnet is brought close to the hall effect sensor. If it's been installed correctly, the LED timer should initiate.