Bluepad32 by Ricardo Quesada: To add these libraries go to file->preferences and paste the two links below in Additional boards manager URLs.
esp32 by Espressif Systems and Bluepad32
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
https://raw.githubusercontent.com/ricardoquesada/esp32-arduino-lib-builder/master/bluepad32_files/package_esp32_bluepad32_index.json
Click the box shown in the image below
Use bluepad32 version 4.1.0 and esp32 version 3.2.1
If you see the following error you must resolve it in the steps below.
esp32:esp-x32@2511
Failed to install platform: 'esp32:esp32:3.3.7'.
Error: 4 DEADLINE_EXCEEDED: net/http: request canceled
(Client.Timeout or context cancellation while reading body)
Open arduino-cli.yaml in a text editor WITH the Arduino IDE already open. The filepath is as follows:
Linux/Mac: ~/.arduinoIDE/arduino-cli.yaml
Windows: C:\Users\YourUsername.arduinoIDE\arduino-cli.yaml
After you open this document you will need to add the following lines of code
network:
connection_timeout: 600s
Make sure to indent connection_timeout: 600s and then save
The image below shows what the corrected file should look like
AFTER YOU INSTALL THE LIBRARIES GO BACK INTO THE arduino-cli.yamkl FILE AND REMOVE THE CODE WE ADDED OR ELSE THE IDE MAY NOT BOOT UP IN THE FUTURE
The code can be compiled for either the Hub microcontroller or Rover microcontroller. Before downloading the code go to BuildConfig.hpp and change TRANSCEIVER_BUILD to either HUB_BUILD or ROVER_BUILD.
The Hub microcontroller compilation uses Bluepad32 (a Bluetooth protocol) to read in data from a controller. It then uses ESP-NOW to send it to the Rover microcontroller. The Hub configuration should use the esp32 dev module by esp32_bluepad32 board when downloading the code. This is seen in the image below.
The Rover microcontroller configuration solely uses the ESP-NOW protocol. Additionally, to minimize the packet loss that occurs from running both Bluetooth and ESP-NOW at the same time, the rover microcontroller is set to disable power saving mode. This option cannot be disabled if both Bluetooth and ESP-NOW are running and since bluepad32 automatically enables Bluetooth, we cannot use that board configuration. The correct board that should be selected is esp32 dev module by esp32. This can be seen in the image below.
B - Rotate Barrel A - Launch Disks Y - Pause Rover X - Reset HDM Values
Dpad Left - Rotate Clockwise Dpad Right - Rotate Counterclock
L1 (front left bumper) - Increase power by 5 L2 (Back left bumper) - Decrease power by 5
R1 (front right bumper) - Increase disk count by 1 R2 (Back right bumper) - Decrease disk count by 1
Right joystick - Right wheel (halfway is 10RPM full is 30RPM) Left joystick - Left wheel (halfway is 10RPM full is 30RPM)