If you have not connected the joystick breakout module to one of the Arduino's you will need to do it before you start this project. Once the joystick breakout module is connected to the Arduino, we will write the code that will read the position of the joystick and transmit it to the other Arduino via the HC-05 Bluetooth modules; however, before we do this we need to figure out the protocol that we are going to use.
For this example, we will use the same protocol that we used in the previous project, where the message will start off with a 0x01 byte and end with a 0x04 byte and everything in between is the message itself. The message itself will contain two bytes, one that indicates the x position of the joystick and one that indicates the y position. Therefore, a complete transmission will contain a total of four bytes likes this...