PS4 ESP32 Wrover Module Error

I'm a beginner in programming with Arduino and I have the following issue: :face_in_clouds:
I want to connect my ESP32 with a PS4 Controller, and I'm using this code:

#include <PS4Controller.h>

void setup() {
  Serial.begin(115200);
  
  PS4.begin("01:01:01:01:01:01");
  Serial.println("Initialization ready!");
}

void loop() {
  if (PS4.isConnected()) {
    Serial.println("Controller connected");
  }

  delay(1000);
}

from

(ESP32: Connecting a PS4 Controller - techtutorialsx)

but I get this error:

C:\Users\####\OneDrive\Dokumente\Arduino\libraries\PS4-esp32-master\src\ps4_spp.c: In function 'sppCallback':
C:\Users\####\OneDrive\Dokumente\Arduino\libraries\PS4-esp32-master\src\ps4_spp.c:87:30: error: 'ESP_BT_CONNECTABLE' undeclared (first use in this function)
     esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_NON_DISCOVERABLE);
                              ^
C:\Users\####\OneDrive\Dokumente\Arduino\libraries\PS4-esp32-master\src\ps4_spp.c:87:30: note: each undeclared identifier is reported only once for each function it appears in
C:\Users\####\OneDrive\Dokumente\Arduino\libraries\PS4-esp32-master\src\ps4_spp.c:87:50: error: 'ESP_BT_NON_DISCOVERABLE' undeclared (first use in this function)
     esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_NON_DISCOVERABLE);
                                                  ^
C:\Users\####\OneDrive\Dokumente\Arduino\libraries\PS4-esp32-master\src\ps4_spp.c:87:5: error: too many arguments to function 'esp_bt_gap_set_scan_mode'
     esp_bt_gap_set_scan_mode(ESP_BT_CONNECTABLE, ESP_BT_NON_DISCOVERABLE);
     ^
In file included from C:\Users\####\OneDrive\Dokumente\Arduino\libraries\PS4-esp32-master\src\ps4_spp.c:4:0:
C:\Users\####\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.6/tools/sdk/include/bt/esp_gap_bt_api.h:370:11: note: declared here
 esp_err_t esp_bt_gap_set_scan_mode(esp_bt_scan_mode_t mode);
           ^
exit status 1
Fehler beim Kompilieren fΓΌr das Board ESP32 Wrover Module.

:roll_eyes:

My PS4 Controller have already this Bluetooth adress:

image

To begin I've tried to upload the arduino sketch example "Blink" to the ESP32 and that worked fine... :thinking:
I can't find the issue and I would be pleased if somebody could help me :smiley:

1 Like

There is a pretty good chance to find hints by qoogling with the reported error:

: error: 'ESP_BT_CONNECTABLE' undeclared (first use in this function

qoogle with ESP_BT_CONNECTABLE' undeclared

https://www.google.de/search?as_q=error%253A+'ESP_BT_CONNECTABLE'+undeclared

found this thread

which has suggestions on how to solve the problem.

best regards Stefan

1 Like

Thank you very much! :star_struck: :star_struck:
It now works how it supposed to be :grin:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.