Today we had access to the physical side of the project, so I tested my Bluetooth code (see my previous post) with the Arduino side. Luckily, after pairing with the HC-05 Bluetooth component, the code worked first time without need for debugging!
Chris and I modified the Arduino code to output different lighting effects based on the character sent across Bluetooth. We decided on the default being Red, with a breathing effect (which I created for a previous project) and a rainbow spin effect.
How it works
- When the local server is started, it searches through paired devices to find the HC-05 module.
- When it is found, it opens a connection and sends it the instruction to turn on.
- When the generate button is pressed, a new message is sent across the connection instructing it to run the rainbow effect.
To begin with, we were going to use a separate mobile app to input user data across Bluetooth to the Arduino. Switching instead to using the same input as the user data adds a level of interactivity than we would have previously had from a separate phone app. It allows a user to instantly see the effect their inputs have had even before the visualization updates.
This also ties the piece together better, making it an all-in-one system rather than being split up.
If we had more time, I would modify the code to react differently depending on some of the user inputted data, such as changing colours or effects based on values.