Week 20: Nov 1st - Nov 7th
- Neil Bishop
- Nov 6, 2022
- 1 min read
When connecting Bluetooth devices, the devices must first be paired with each other then a connection must be established in order to communicate using serial data transmission. Our program was first designed to only establish this connection but it was not made to have an error catch in the case that the device could not be found.
To solve this problem, I created a function that handles the first connection whether or not the RCMS is available to connect. It first searches the PC’s comports to find the outgoing Bluetooth connection. Once it discovers the device it tries to connect but also has an exception handler that is flagged when the device cannot connect. If this is flagged, the user is prompted a message that warns them about the device and then asks to try again to connect.
As a demonstration, the device is disconnected and the program is run and allows the program to search twice for the device. After the two tries, the Bluetooth module is reconnected to the Arduino and the program successfully connects and the GUI is opened.
Comments