Hello,
Newbie here. I am trying to connect a ps4 controller to a Nano esp32. I am trying to follow this youtube video from #includeelectronics to get this working. I downloaded the ps4 controller library from juan pablo marquez's github. In the video he link additional board manager url to: "https://dl.espressif.com/dl/package_esp32_index.json" and so I copied that. It seems weird to me because I'm using an arduino nano, not an espressif board; but since I don't know if it matters or not I copied it. Maybe someone can clarify that for me. Anyway, the video then installs the esp32 (espressif) in the board manager. I was going to follow that, but saw that arduino had their own version of esp32 so I installed that. Does that matter if the link and the installed boards are different? Anyway, the video goes on to post this code:
#include "PS4Controller.h"
#include "esp_bt_main.h"
#include "esp_bt_device.h"
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
PS4.begin();
const uint8_t* address = esp_bt_dev_get_address();
char str[100];
sprintf(str, "ESP32's Bluetooth MAC address is - %02x:%02x:%02x:%02x:%02x:%02x", address[0], address[1], address[2], address[3], address[4], address[5]);
Serial.println(str);
}
void loop() {
// put your main code here, to run repeatedly:
}
Now in the video he uploads this to the board. This fails for me. So I tried to verify the code and get the following error message:
-/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-
c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_l2cap.c.o:(.literal.ps4_l2cap_disconnect_ind_cback+0x4): undefined reference to L2CA_DisconnectRsp' c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_l2cap.c.o:(.literal.ps4_l2cap_config_ind_cback+0x0): undefined reference to
L2CA_ConfigRsp'
c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_l2cap.c.o:(.literal.ps4_l2cap_connect_ind_cback+0x8): undefined reference to L2CA_ErtmConnectRsp' c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_l2cap.c.o:(.literal.ps4_l2cap_connect_ind_cback+0xc): undefined reference to
L2CA_ConfigReq'
c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_l2cap.c.o:(.literal.ps4_l2cap_init_service+0x14): undefined reference to L2CA_Register' c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_l2cap.c.o:(.literal.ps4_l2cap_send_hid+0x18): undefined reference to
L2CA_DataWrite'
c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_l2cap.c.o: in function ps4_l2cap_disconnect_ind_cback': c:\Users\snapp\Documents\Arduino\libraries\PS4Controller\src/ps4_l2cap.c:269: undefined reference to
L2CA_DisconnectRsp'
c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_l2cap.c.o: in function ps4_l2cap_config_ind_cback': c:\Users\snapp\Documents\Arduino\libraries\PS4Controller\src/ps4_l2cap.c:252: undefined reference to
L2CA_ConfigRsp'
c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_l2cap.c.o: in function ps4_l2cap_connect_ind_cback': c:\Users\snapp\Documents\Arduino\libraries\PS4Controller\src/ps4_l2cap.c:186: undefined reference to
L2CA_ErtmConnectRsp'
c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: c:\Users\snapp\Documents\Arduino\libraries\PS4Controller\src/ps4_l2cap.c:189: undefined reference to L2CA_ErtmConnectRsp' c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: c:\Users\snapp\Documents\Arduino\libraries\PS4Controller\src/ps4_l2cap.c:192: undefined reference to
L2CA_ConfigReq'
c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_l2cap.c.o: in function ps4_l2cap_init_service': c:\Users\snapp\Documents\Arduino\libraries\PS4Controller\src/ps4_l2cap.c:144: undefined reference to
L2CA_Register'
c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_l2cap.c.o: in function ps4_l2cap_send_hid': c:\Users\snapp\Documents\Arduino\libraries\PS4Controller\src/ps4_l2cap.c:115: undefined reference to
L2CA_DataWrite'
c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_spp.c.o:(.literal.sppCallback+0x8): undefined reference to esp_bt_gap_set_scan_mode' c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_spp.c.o:(.literal.sppCallback+0xc): undefined reference to
esp_spp_start_srv'
c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_spp.c.o:(.literal.sppInit+0x14): undefined reference to esp_spp_register_callback' c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_spp.c.o:(.literal.sppInit+0x18): undefined reference to
esp_spp_init'
c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_spp.c.o: in function sppCallback': c:\Users\snapp\Documents\Arduino\libraries\PS4Controller\src/ps4_spp.c:126: undefined reference to
esp_bt_gap_set_scan_mode'
c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: c:\Users\snapp\Documents\Arduino\libraries\PS4Controller\src/ps4_spp.c:127: undefined reference to esp_spp_start_srv' c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\libraries\PS4Controller\ps4_spp.c.o: in function
sppInit':
c:\Users\snapp\Documents\Arduino\libraries\PS4Controller\src/ps4_spp.c:56: undefined reference to esp_spp_register_callback' c:/users/snapp/appdata/local/arduino15/packages/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: c:\Users\snapp\Documents\Arduino\libraries\PS4Controller\src/ps4_spp.c:65: undefined reference to
esp_spp_init'
collect2.exe: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1
-/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/--/-
Also when I click the debug button two bubbles popup that say:
- Unable to find executable file at C:/Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\My_PS4Controller_to_ESP32.ino.elf.
- File not found "executable": "C:/Users\snapp\AppData\Local\Temp\arduino\sketches\DDA3795F080822F040816F62E575CB4F\My_PS4Controller_to_ESP32.ino.elf"
Do you need more info? I would be happy to give more, but being a newbie I'm not sure what else to provide. Can you please help me figure out how to resolve this?