Rally bluetooth controller

Hi, is here somebody who can help?
I try to upload code to ESP 32 board, but after compileing sketch there is an error warning: Compilation error: 'ESP_MAC_WIFI_STA' was not declared in this scope; did you mean 'ESP_IF_WIFI_STA'?

Here is a code

#include <Arduino.h>
#include <BleKeyboard.h>
#include <Preferences.h> 
#include <WiFi.h> // For getting the MAC address
#if SOFTWARE_SERIAL_AVAILABLE
#include <SoftwareSerial.h>
#endif

// Declare function prototype for generating a serial number
String generateSerialNumber();

// Create a BLE Keyboard instance
BleKeyboard bleKeyboard;

// Create a Preference instance for saving settings
Preferences preferences;

// Define variables
const String RR_Version = "V2.5.1";
const int button1state = LOW;
const int button2state = LOW;
const int button3state = LOW;
const int button4state = LOW;
const int button5state = LOW;

// Define the pins for the LEDs
const int ledBLUE = 34;  // Blue LED pin
const int ledRED  = 22;  // Red LED pin

// Define the pins for the pushbuttons
const int button1 = 19;  // Button 1 pin
const int button2 = 18;  // Button 2 pin
const int button3 = 5;  // Button 3 pin
const int button4 = 4;  // Button 4 pin
const int button5 = 2;   // Button 5 pin

// Define the pin for the mode switch button.
const int modeSelect = 21;

// Default value for the selected app. Change this if you want a different default app.
// 0: No softapp yet
// 1: Locus Maps
// 2: Rally Navigator
// 3: OsMand
// 4: Piste Roadbook Reader
// 5: Terra Pirata
int softApp = 0; //Locus set as default when starting unit
int softAppSaveValue;   // temp softApp value for EEPROM

// Define the delay time in ms between button presses and between toggle switches.
const int buttonWait = 250;  // Button delay time
const int toggleWait = 20;  // Toggle switch delay time
const int ledFlashDelay = 150;
const int ColorBlack = 0;
const int ColorBlue = 1;
const int ColorRed = 2;

// Function to blink the blue LED
void blinkBlueLed() {
  digitalWrite(ledBLUE, LOW);
  delay(150);
  digitalWrite(ledBLUE, HIGH);
}

// Function to generate a serial number based on the last 3 bytes of the MAC address
// Function to generate a 6-digit serial number based on the last 3 bytes of the MAC address
String generateSerialNumber() {
  uint8_t baseMac[6];
  esp_read_mac( baseMac,ESP_MAC_WIFI_STA); // Read the MAC address
  // Extract the last 3 bytes of the MAC address and convert them to a 6-character string
  char serialNumber[7]; // 6 hex digits + null terminator
  sprintf(serialNumber, "%02X%02X%02X", baseMac[3], baseMac[4], baseMac[5]);

  return String(serialNumber); // Return the 6-character serial number
}

// Function to get the unique chip ID as a serial number
/*String getChipID() {
  // The chip ID is based on the last 24 bits of the MAC address
  uint32_t chipId = 0;
  for(int i=0; i<17; i+=8) {
    chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xFF) << i;
  }
  return String(chipId);
}*/


// Forward declarations
void flashLedIndicator(int FlashCount, int FlashDelay, int FlashColor);
void storeSoftApp(int softAppVal);

////////////////////////////////////////////////////////////////////////////////////////////////
// This function is called once when your program starts. It's used to initialize variables, 
// input and output pin modes, and other libraries needed by your sketch.
////////////////////////////////////////////////////////////////////////////////////////////////
void setup() {
  // Initialize serial communication for debugging
  Serial.begin(115200);
  Serial.println("Starting Rampage Controller ...");

  // Load previous softApp selection from preferences
  preferences.begin("my-app", false);  // Open preferences
  softAppSaveValue = preferences.getUInt("counter", 0);  // Retrieve saved value
  preferences.end();  // Close preferences

  // Set the softApp to the saved value
  if (softAppSaveValue > 5) {
    softApp = 0;  // Reset to 0 if the value exceeds the number of apps
  } else {
    softApp = softAppSaveValue;  // Otherwise, set to the saved value
  }

  // PRINT STARTUP STATUS
  Serial.print("Rampage Controller Version: ");
  Serial.println(RR_Version);
  Serial.print("You are in softApp: ");
  Serial.println(softApp);

  // Generate BLE name with version and chip ID
  String bleName = "Rampage_" + generateSerialNumber();
  Serial.print("BLE Name: ");
  Serial.println(bleName);  // Print to check the full name

  // Initialize BLE with the generated name
  bleKeyboard = BleKeyboard(bleName.c_str());
  bleKeyboard.begin();

  Serial.println("BLE Keyboard started and advertising...");
  Serial.print("BLE Advertising with name: ");
  Serial.println(bleName);
  
  // Set up button pins as input with built-in pullup resistors
  pinMode(button1, INPUT_PULLUP);
  pinMode(button2, INPUT_PULLUP);
  pinMode(button3, INPUT_PULLUP);
  pinMode(button4, INPUT_PULLUP);
  pinMode(button5, INPUT_PULLUP);

  // Set up LED pins as output
  pinMode(ledBLUE, OUTPUT);
  pinMode(ledRED, OUTPUT);

  // Set up mode select switch pin as input with built-in pullup resistor.
  pinMode(modeSelect, INPUT_PULLUP);

  // Indicate ready state by setting the blue LED on
  digitalWrite(ledBLUE, HIGH);
  digitalWrite(ledRED, LOW);
}


////////////////////////////////////////////////////////////////////////////////////////////////
// THIS IS THE LOOP SECTION OF THE CODE THAT KEEPS LOOPING AND RUNNING
////////////////////////////////////////////////////////////////////////////////////////////////
void loop()
{
  //////////////////////////////////////////////////////////////
  // START SOFT APP SELECT LOOP
  //////////////////////////////////////////////////////////////

  // The digitalRead(modeSelect) function checks if the mode select button has been pressed (LOW means button press)
  if (digitalRead(modeSelect) == LOW) {
    
    // Turn on the red LED (HIGH) and turn off the blue LED (LOW)
    flashLedIndicator(0,0,ColorRed); //Set Red Led
 
    // Check if button 1 has been pressed
    if (digitalRead(button1) == button1state) {
      // If button 1 has been pressed, set the softApp variable to 1
      softApp = 1;
      storeSoftApp(softApp);
      // Output a message to the serial console
      Serial.println("While in Mode Select you have selected softApp 1: Locus Maps.");
      // Send a message via Bluetooth to the connected device
      if (bleKeyboard.isConnected()) {
         bleKeyboard.println("App 1: Locus"); }
      // Call function to flash LED according to softApp # selected
      flashLedIndicator(1,ledFlashDelay,ColorBlue);
    } 
    // End of select softapp 1

    // Check if button 2 has been pressed
    // The sequence of operations is the same as for button 1, but softApp is set to 2
    if (digitalRead(button2) == button2state) {
      softApp = 2;
      storeSoftApp(softApp);
      Serial.println("While in Mode Select you have selected softApp 2: Rally Navigator.");
      // Send a message via Bluetooth to the connected device
      if (bleKeyboard.isConnected()) {
         bleKeyboard.println("App 2: Rally"); }
      // Call function to flash LED according to softApp # selected
      flashLedIndicator(2,ledFlashDelay,ColorBlue);
    } 
    // End of select softapp 2

    // Check if button 3 has been pressed
    // The sequence of operations is the same as for button 1 and 2, but softApp is set to 3
    if (digitalRead(button3) == button3state) {
      softApp = 3;
      storeSoftApp(softApp);
      Serial.println("While in Mode Select you have selected softApp 3: OsMand.");
      // Send a message via Bluetooth to the connected device
      if (bleKeyboard.isConnected()) {
         bleKeyboard.println("App 3: OsMand"); }
      // Call function to flash LED according to softApp # selected
      flashLedIndicator(3,ledFlashDelay,ColorBlue);
    } 
    // End of select softapp 3

    // Check if button 4 has been pressed
    // The sequence of operations is the same as for button 1, 2, and 3, but softApp is set to 4
    if (digitalRead(button4) == button4state) {
      softApp = 4;
      storeSoftApp(softApp);
      Serial.println("While in Mode Select you have selected softApp 4: Piste Roadbook Reader.");
      // Send a message via Bluetooth to the connected device
      if (bleKeyboard.isConnected()) {
         bleKeyboard.println("App 4: Piste"); }
      // Call function to flash LED according to softApp # selected
      flashLedIndicator(4,ledFlashDelay,ColorBlue);
    } 
    // End of select softapp 4

    // Check if button 5 has been pressed
    if (digitalRead(button5) == button5state) {
      softApp = 5;
      storeSoftApp(softApp);
      Serial.println("While in Mode Select you have selected softApp 5: Terra Pirata.");
      // Send a message via Bluetooth to the connected device
      if (bleKeyboard.isConnected()) {
         bleKeyboard.println("App 5: Terra Pirata"); }
      // Call function to flash LED according to softApp # selected
      flashLedIndicator(5,ledFlashDelay,ColorBlue);
    } 
    // End of select softapp 5
    
  }
  ///////////////////////////////////////////////////////////////////////////////////////
  // END SOFT APP SELECT LOOP
  ///////////////////////////////////////////////////////////////////////////////////////

  ///////////////////////////////////////////////////////////////////////////////////////
  // START SOFT APP RUN LOOP
  ///////////////////////////////////////////////////////////////////////////////////////
  if (digitalRead(modeSelect) == HIGH) {
    flashLedIndicator(0,0,ColorBlue); // Set Blue Led
    delay(ledFlashDelay);
    if (!bleKeyboard.isConnected()) {
       flashLedIndicator(1,ledFlashDelay,ColorRed); }

    if (softApp == 0) { // App 0 No softApp value yet
       Serial.println("You are in softApp: ZERO");
       flashLedIndicator(1,ledFlashDelay,ColorRed);
    } // End softapp 0

    if (softApp == 1) { 
       // App 1 Locus Maps : Button 1 : Zoom In : Vol +
       // App 1 Locus Maps : Button 2 : Zoom Out : Vol -
       // App 1 Locus Maps : Button 3 : Map Up : 'r'
       // App 1 Locus Maps : Button 4 : Centre Map : 'c'
       // App 1 Locus Maps : Button 5 : Display on/off : 'd'

       flashLedIndicator(0,0,ColorBlue);
       // PUSH BUTTONS
       if (digitalRead(button1) == button1state) {
          Serial.println("Button 1 - Locus - Volume Up");
          // Sending the command for zooming in : Volume Up
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_VOLUME_UP); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button2) == button2state) {
          Serial.println("Button 2 - Locus - Volume Down");
          // Sending the command for zooming out : Volume Down
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_VOLUME_DOWN); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button3) == button3state) {
          Serial.println("Button 3 - Locus - 'r' key");
          // Sending the command for map up : the 'r' key 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('r'); } // Key r
             flashLedIndicator(1,10,ColorBlack);
        }
       if (digitalRead(button4) == button4state) {
          Serial.println("Button 4 - Locus - 'c' key");
          // Sending the command for Map Centre : 'c' key 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('c'); } // key c
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button5) == button5state) {
          Serial.println("Button 5 - Locus - 'd' key");
          // Sending the command for Display : 'd' key 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('d'); } // key d
             flashLedIndicator(1,10,ColorBlack);
         }
    } // End softapp 1

    if (softApp == 2) { 
       
       // App 2 Rally Navigator : Button 1 : Trip UP : Vol +
       // App 2 Rally Navigator : Button 2 : Trip Down : Vol -
       // App 2 Rally Navigator : Button 4 : Scroll UP : Media Next
       // App 2 Rally Navigator : Button 5 : Scroll Down : Media Previous

       flashLedIndicator(0,0,ColorBlue);
       // PUSH BUTTONS
       if (digitalRead(button1) == button1state) {
          Serial.println("Button 1 - Rally - Volume Up");
          // Sending the command for Trip UP : Volume Up
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_VOLUME_UP); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button2) == button2state) {
          Serial.println("Button 2 - Rally - Volume Down");
          // Sending the command for Trip Down : Volume Down
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_VOLUME_DOWN); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button4) == button4state) {
          Serial.println("Button 4 - Rally - Next Media");
          // Sending the command for Scroll UP : Next Media 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_NEXT_TRACK); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button5) == button5state) {
          Serial.println("Button 5 - Rally - Prev Media");
          // Sending the command for Scroll Down : Prev Media 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_PREVIOUS_TRACK); }
             flashLedIndicator(1,10,ColorBlack);
         }
    } // End softapp 2

    if (softApp == 3) { 

       // App 3 OsMand : Button 1 : Pan UP : Dpad_Up
       // App 3 OsMand : Button 2 : Pan Down : Dpad_Down
       // App 3 OsMand : Button 3 : Centre : 'c'
       // App 3 OsMand : Button 4 : Pan Left : Dpad_Left
       // App 3 OsMand : Button 5 : Pan Right : Dpad_Right

       flashLedIndicator(0,0,ColorBlue);
       // PUSH BUTTONS
       if (digitalRead(button1) == button1state) {
          Serial.println("Button 1 - OsMand - Dpad_Up");
          // Sending the command for Pan UP : Dpad_Up
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_UP_ARROW); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button2) == button2state) {
          Serial.println("Button 2 - OsMand - Dpad_Down");
          // Sending the command for Pan Down : Dpad_Down
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_DOWN_ARROW); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button3) == button3state) {
          Serial.println("Button 3 - OsMand - Keycode_C");
          // Sending the command for Centre : Keycode_C 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('c'); }
             flashLedIndicator(1,10,ColorBlack);
        }
       if (digitalRead(button4) == button4state) {
          Serial.println("Button 4 - OsMand - Dpad_Left");
          // Sending the command for Pan Left : Dpad_Left 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_LEFT_ARROW); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button5) == button5state) {
          Serial.println("Button 5 - OsMand - Dpad_Right");
          // Sending the command for Pan Right : Dpad_Right 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_RIGHT_ARROW); }
             flashLedIndicator(1,10,ColorBlack);
         }
    } // End softapp 3

    if (softApp == 4) { 
      
       // App 4 Piste : Button 1 : Rb Scroll Fwd : w
       // App 4 Piste : Button 2 : Rb Scroll Rev : x
       // App 4 Piste : Button 3 : Trip + : a
       // App 4 Piste : Button 4 : Trip - : d
       // App 4 Piste : Button 5 : Medial Play/Pause : q

       flashLedIndicator(0,0,ColorBlue);
       // PUSH BUTTONS
       if (digitalRead(button1) == button1state) {
          Serial.println("Button 1 - Piste - 'w' key");
          // Sending the command for Rb Scroll Fwd : 'w' key
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('w'); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button2) == button2state) {
          Serial.println("Button 2 - Piste - 'x' key");
          // Sending the command for Rb Scroll Rev : 'x' key
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('x'); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button3) == button3state) {
          Serial.println("Button 3 - Piste - 'a' key");
          // Sending the command for Trip + : 'a' key 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('a'); }
             flashLedIndicator(1,10,ColorBlack);
        }
       if (digitalRead(button4) == button4state) {
          Serial.println("Button 4 - Piste - 'd' key");
          // Sending the command for Trip - : 'd' key 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('d'); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button5) == button5state) {
          Serial.println("Button 5 - Piste - 'q' key");
          // Sending the command for Medial Play/Pause : 'q' key 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('q'); }
             flashLedIndicator(1,10,ColorBlack);
         }
    } // End softapp 4

    if (softApp == 5) { 
       
       // App 5 Rally Navigator : Button 1 : Fwd scroll : Media Next
       // App 5 Rally Navigator : Button 2 : Rev scroll : Media Previous
       // App 5 Rally Navigator : Button 3 : Trip + : Vol -
       // App 5 Rally Navigator : Button 4 : Trip - : Vol +
       // App 5 Rally Navigator : Button 5 : Lock screen : x

       flashLedIndicator(0,0,ColorBlue);
       // PUSH BUTTONS
       if (digitalRead(button1) == button1state) {
          Serial.println("Button 1 - media next scroll forward");
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_NEXT_TRACK); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button2) == button2state) {
          Serial.println("Button 2 - media previous scroll down");
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_PREVIOUS_TRACK); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button3) == button3state) {
          Serial.println("Button 3 - Volume - trip +");
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_VOLUME_DOWN); }
             flashLedIndicator(1,10,ColorBlack);
        }
       if (digitalRead(button4) == button4state) {
          Serial.println("Button 4 - Volume + Trip -");
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_VOLUME_UP); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button5) == button5state) {
          Serial.println("Button 5 - Lock screen");
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('x'); }
             flashLedIndicator(1,10,ColorBlack);
         }
    } // End softapp 5
  } // End of HIGH state button loop
} // End of loop code

void flashLedIndicator(int FlashCount, int FlashDelay, int FlashColor) {
  if (FlashCount == 0) {
     if (FlashColor == ColorBlue) {
        digitalWrite(ledBLUE, HIGH);  // Turn on the blue LED
        digitalWrite(ledRED, LOW); }  // Turn off the red LED
     if (FlashColor == ColorRed) {
        digitalWrite(ledBLUE, LOW);   // Turn off the blue LED
        digitalWrite(ledRED, HIGH); }  // Turn on the red LED
     if (FlashColor == ColorBlack) {
        digitalWrite(ledBLUE, LOW);   // Turn off the blue LED
        digitalWrite(ledRED, LOW); }   // Turn off the red LED
     }  
  else {
     int ledBlueState = digitalRead(ledBLUE);
     int ledRedState = digitalRead(ledRED);
     digitalWrite(ledBLUE, LOW);
     digitalWrite(ledRED, LOW);
     delay (FlashDelay);
     for (int i = 1; i <= FlashCount; i++) {
        if (FlashColor == ColorBlue) digitalWrite(ledBLUE, HIGH);
        if (FlashColor == ColorRed) digitalWrite(ledRED, HIGH);
        delay(FlashDelay);
        digitalWrite(ledBLUE, LOW);
        digitalWrite(ledRED, LOW);
        delay(FlashDelay);
     }
     digitalWrite(ledBLUE, ledBlueState);     
     digitalWrite(ledRED, ledRedState);       
  }
}

void storeSoftApp(int softAppVal) {
  preferences.begin("my-app", false);
  preferences.putUInt("counter", softAppVal); // Use softAppVal instead of counter
  preferences.end();
}
1 Like

Verify your IDE is ready for your hardware. Have you selected the correct board support (which ESP32)? Perhaps the board you selected does not have WIFI, therefore, no need to have a defined value for reading the WIFI MAC?

Thanks for reply. I posted code in right way now....
My board is ESP32 WROOM-32

I do not know the ESP32 (or WROOM-32), but is this the file you need for wifi?

#include "esp_wifi.h"

Found here... Wi-Fi - ESP32 - — ESP-IDF Programming Guide v5.4.1 documentation

No, it's
#include <WiFi.h>

Try adding:
#include <esp_mac.h>

It still doesn't work ...

Not the most informative of feedback. What didn't work? Post the updated code. Post the complete error message verbatim, not your paraphrased version of it. What version of the Arduino ESP32 Board Core Package are you using?

C:\Users\juraj\Downloads\2.5.1 Rampage Bluetooth Controller 2.5.1\2.5.1 Rampage Bluetooth Buttons Open Source Files Stable 20240831\03 Arduino Code\rampage_navigator_version_2.5.1\rampage_navigator_version_2.5.1.ino: In function 'String generateSerialNumber()':
C:\Users\juraj\Downloads\2.5.1 Rampage Bluetooth Controller 2.5.1\2.5.1 Rampage Bluetooth Buttons Open Source Files Stable 20240831\03 Arduino Code\rampage_navigator_version_2.5.1\rampage_navigator_version_2.5.1.ino:81:25: error: 'ESP_MAC_WIFI_STA' was not declared in this scope; did you mean 'ESP_IF_WIFI_STA'?
   81 |   esp_read_mac( baseMac,ESP_MAC_WIFI_STA); // Read the MAC address
      |                         ^~~~~~~~~~~~~~~~
      |                         ESP_IF_WIFI_STA
C:\Users\juraj\Downloads\2.5.1 Rampage Bluetooth Controller 2.5.1\2.5.1 Rampage Bluetooth Buttons Open Source Files Stable 20240831\03 Arduino Code\rampage_navigator_version_2.5.1\rampage_navigator_version_2.5.1.ino:81:3: error: 'esp_read_mac' was not declared in this scope
   81 |   esp_read_mac( baseMac,ESP_MAC_WIFI_STA); // Read the MAC address
      |   ^~~~~~~~~~~~
exit status 1

Compilation error: 'ESP_MAC_WIFI_STA' was not declared in this scope; did you mean 'ESP_IF_WIFI_STA'?

Serves me right for putting more than one request in a post. One more time ....

// RALLY RAMPAGE BLUETOOTH BIKE HANDLEBAR NAVIGATION CONTROLLER
// www.rallyrampage.com
// Version: 2.5.1 (Stable BLE and LED Status Update)
// Updated: 2024-10-14
// Ownership: Rally Rampage
// Published by: Rally Rampage
// Target Hardware: ESP32 Wroom Development Board
// UNIQUE FEATURES
// Five apps commands including Terra Pirata Roadbook Reader
// Remembers the last app when lost power
// reconnects on power up again

#include <Arduino.h>
#include <BleKeyboard.h>
#include <Preferences.h> 
#include <WiFi.h> // For getting the MAC address
#if SOFTWARE_SERIAL_AVAILABLE
#include <SoftwareSerial.h>
#include <esp_mac.h>
#include "esp_wifi.h"
#endif

// Declare function prototype for generating a serial number
String generateSerialNumber();

// Create a BLE Keyboard instance
BleKeyboard bleKeyboard;

// Create a Preference instance for saving settings
Preferences preferences;

// Define variables
const String RR_Version = "V2.5.1";
const int button1state = LOW;
const int button2state = LOW;
const int button3state = LOW;
const int button4state = LOW;
const int button5state = LOW;

// Define the pins for the LEDs
const int ledBLUE = 34;  // Blue LED pin
const int ledRED  = 22;  // Red LED pin

// Define the pins for the pushbuttons
const int button1 = 19;  // Button 1 pin
const int button2 = 18;  // Button 2 pin
const int button3 = 5;  // Button 3 pin
const int button4 = 4;  // Button 4 pin
const int button5 = 2;   // Button 5 pin

// Define the pin for the mode switch button.
const int modeSelect = 21;

// Default value for the selected app. Change this if you want a different default app.
// 0: No softapp yet
// 1: Locus Maps
// 2: Rally Navigator
// 3: OsMand
// 4: Piste Roadbook Reader
// 5: Terra Pirata
int softApp = 0; //Locus set as default when starting unit
int softAppSaveValue;   // temp softApp value for EEPROM

// Define the delay time in ms between button presses and between toggle switches.
const int buttonWait = 250;  // Button delay time
const int toggleWait = 20;  // Toggle switch delay time
const int ledFlashDelay = 150;
const int ColorBlack = 0;
const int ColorBlue = 1;
const int ColorRed = 2;

// Function to blink the blue LED
void blinkBlueLed() {
  digitalWrite(ledBLUE, LOW);
  delay(150);
  digitalWrite(ledBLUE, HIGH);
}

// Function to generate a serial number based on the last 3 bytes of the MAC address
// Function to generate a 6-digit serial number based on the last 3 bytes of the MAC address
String generateSerialNumber() {
  uint8_t baseMac[6];
  esp_read_mac( baseMac,ESP_MAC_WIFI_STA); // Read the MAC address
  // Extract the last 3 bytes of the MAC address and convert them to a 6-character string
  char serialNumber[7]; // 6 hex digits + null terminator
  sprintf(serialNumber, "%02X%02X%02X", baseMac[3], baseMac[4], baseMac[5]);

  return String(serialNumber); // Return the 6-character serial number
}

// Function to get the unique chip ID as a serial number
/*String getChipID() {
  // The chip ID is based on the last 24 bits of the MAC address
  uint32_t chipId = 0;
  for(int i=0; i<17; i+=8) {
    chipId |= ((ESP.getEfuseMac() >> (40 - i)) & 0xFF) << i;
  }
  return String(chipId);
}*/


// Forward declarations
void flashLedIndicator(int FlashCount, int FlashDelay, int FlashColor);
void storeSoftApp(int softAppVal);

////////////////////////////////////////////////////////////////////////////////////////////////
// This function is called once when your program starts. It's used to initialize variables, 
// input and output pin modes, and other libraries needed by your sketch.
////////////////////////////////////////////////////////////////////////////////////////////////
void setup() {
  // Initialize serial communication for debugging
  Serial.begin(115200);
  Serial.println("Starting Rampage Controller ...");

  // Load previous softApp selection from preferences
  preferences.begin("my-app", false);  // Open preferences
  softAppSaveValue = preferences.getUInt("counter", 0);  // Retrieve saved value
  preferences.end();  // Close preferences

  // Set the softApp to the saved value
  if (softAppSaveValue > 5) {
    softApp = 0;  // Reset to 0 if the value exceeds the number of apps
  } else {
    softApp = softAppSaveValue;  // Otherwise, set to the saved value
  }

  // PRINT STARTUP STATUS
  Serial.print("Rampage Controller Version: ");
  Serial.println(RR_Version);
  Serial.print("You are in softApp: ");
  Serial.println(softApp);

  // Generate BLE name with version and chip ID
  String bleName = "Rampage_" + generateSerialNumber();
  Serial.print("BLE Name: ");
  Serial.println(bleName);  // Print to check the full name

  // Initialize BLE with the generated name
  bleKeyboard = BleKeyboard(bleName.c_str());
  bleKeyboard.begin();

  Serial.println("BLE Keyboard started and advertising...");
  Serial.print("BLE Advertising with name: ");
  Serial.println(bleName);
  
  // Set up button pins as input with built-in pullup resistors
  pinMode(button1, INPUT_PULLUP);
  pinMode(button2, INPUT_PULLUP);
  pinMode(button3, INPUT_PULLUP);
  pinMode(button4, INPUT_PULLUP);
  pinMode(button5, INPUT_PULLUP);

  // Set up LED pins as output
  pinMode(ledBLUE, OUTPUT);
  pinMode(ledRED, OUTPUT);

  // Set up mode select switch pin as input with built-in pullup resistor.
  pinMode(modeSelect, INPUT_PULLUP);

  // Indicate ready state by setting the blue LED on
  digitalWrite(ledBLUE, HIGH);
  digitalWrite(ledRED, LOW);
}


////////////////////////////////////////////////////////////////////////////////////////////////
// THIS IS THE LOOP SECTION OF THE CODE THAT KEEPS LOOPING AND RUNNING
////////////////////////////////////////////////////////////////////////////////////////////////
void loop()
{
  //////////////////////////////////////////////////////////////
  // START SOFT APP SELECT LOOP
  //////////////////////////////////////////////////////////////

  // The digitalRead(modeSelect) function checks if the mode select button has been pressed (LOW means button press)
  if (digitalRead(modeSelect) == LOW) {
    
    // Turn on the red LED (HIGH) and turn off the blue LED (LOW)
    flashLedIndicator(0,0,ColorRed); //Set Red Led
 
    // Check if button 1 has been pressed
    if (digitalRead(button1) == button1state) {
      // If button 1 has been pressed, set the softApp variable to 1
      softApp = 1;
      storeSoftApp(softApp);
      // Output a message to the serial console
      Serial.println("While in Mode Select you have selected softApp 1: Locus Maps.");
      // Send a message via Bluetooth to the connected device
      if (bleKeyboard.isConnected()) {
         bleKeyboard.println("App 1: Locus"); }
      // Call function to flash LED according to softApp # selected
      flashLedIndicator(1,ledFlashDelay,ColorBlue);
    } 
    // End of select softapp 1

    // Check if button 2 has been pressed
    // The sequence of operations is the same as for button 1, but softApp is set to 2
    if (digitalRead(button2) == button2state) {
      softApp = 2;
      storeSoftApp(softApp);
      Serial.println("While in Mode Select you have selected softApp 2: Rally Navigator.");
      // Send a message via Bluetooth to the connected device
      if (bleKeyboard.isConnected()) {
         bleKeyboard.println("App 2: Rally"); }
      // Call function to flash LED according to softApp # selected
      flashLedIndicator(2,ledFlashDelay,ColorBlue);
    } 
    // End of select softapp 2

    // Check if button 3 has been pressed
    // The sequence of operations is the same as for button 1 and 2, but softApp is set to 3
    if (digitalRead(button3) == button3state) {
      softApp = 3;
      storeSoftApp(softApp);
      Serial.println("While in Mode Select you have selected softApp 3: OsMand.");
      // Send a message via Bluetooth to the connected device
      if (bleKeyboard.isConnected()) {
         bleKeyboard.println("App 3: OsMand"); }
      // Call function to flash LED according to softApp # selected
      flashLedIndicator(3,ledFlashDelay,ColorBlue);
    } 
    // End of select softapp 3

    // Check if button 4 has been pressed
    // The sequence of operations is the same as for button 1, 2, and 3, but softApp is set to 4
    if (digitalRead(button4) == button4state) {
      softApp = 4;
      storeSoftApp(softApp);
      Serial.println("While in Mode Select you have selected softApp 4: Piste Roadbook Reader.");
      // Send a message via Bluetooth to the connected device
      if (bleKeyboard.isConnected()) {
         bleKeyboard.println("App 4: Piste"); }
      // Call function to flash LED according to softApp # selected
      flashLedIndicator(4,ledFlashDelay,ColorBlue);
    } 
    // End of select softapp 4

    // Check if button 5 has been pressed
    if (digitalRead(button5) == button5state) {
      softApp = 5;
      storeSoftApp(softApp);
      Serial.println("While in Mode Select you have selected softApp 5: Terra Pirata.");
      // Send a message via Bluetooth to the connected device
      if (bleKeyboard.isConnected()) {
         bleKeyboard.println("App 5: Terra Pirata"); }
      // Call function to flash LED according to softApp # selected
      flashLedIndicator(5,ledFlashDelay,ColorBlue);
    } 
    // End of select softapp 5
    
  }
  ///////////////////////////////////////////////////////////////////////////////////////
  // END SOFT APP SELECT LOOP
  ///////////////////////////////////////////////////////////////////////////////////////

  ///////////////////////////////////////////////////////////////////////////////////////
  // START SOFT APP RUN LOOP
  ///////////////////////////////////////////////////////////////////////////////////////
  if (digitalRead(modeSelect) == HIGH) {
    flashLedIndicator(0,0,ColorBlue); // Set Blue Led
    delay(ledFlashDelay);
    if (!bleKeyboard.isConnected()) {
       flashLedIndicator(1,ledFlashDelay,ColorRed); }

    if (softApp == 0) { // App 0 No softApp value yet
       Serial.println("You are in softApp: ZERO");
       flashLedIndicator(1,ledFlashDelay,ColorRed);
    } // End softapp 0

    if (softApp == 1) { 
       // App 1 Locus Maps : Button 1 : Zoom In : Vol +
       // App 1 Locus Maps : Button 2 : Zoom Out : Vol -
       // App 1 Locus Maps : Button 3 : Map Up : 'r'
       // App 1 Locus Maps : Button 4 : Centre Map : 'c'
       // App 1 Locus Maps : Button 5 : Display on/off : 'd'

       flashLedIndicator(0,0,ColorBlue);
       // PUSH BUTTONS
       if (digitalRead(button1) == button1state) {
          Serial.println("Button 1 - Locus - Volume Up");
          // Sending the command for zooming in : Volume Up
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_VOLUME_UP); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button2) == button2state) {
          Serial.println("Button 2 - Locus - Volume Down");
          // Sending the command for zooming out : Volume Down
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_VOLUME_DOWN); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button3) == button3state) {
          Serial.println("Button 3 - Locus - 'r' key");
          // Sending the command for map up : the 'r' key 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('r'); } // Key r
             flashLedIndicator(1,10,ColorBlack);
        }
       if (digitalRead(button4) == button4state) {
          Serial.println("Button 4 - Locus - 'c' key");
          // Sending the command for Map Centre : 'c' key 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('c'); } // key c
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button5) == button5state) {
          Serial.println("Button 5 - Locus - 'd' key");
          // Sending the command for Display : 'd' key 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('d'); } // key d
             flashLedIndicator(1,10,ColorBlack);
         }
    } // End softapp 1

    if (softApp == 2) { 
       
       // App 2 Rally Navigator : Button 1 : Trip UP : Vol +
       // App 2 Rally Navigator : Button 2 : Trip Down : Vol -
       // App 2 Rally Navigator : Button 4 : Scroll UP : Media Next
       // App 2 Rally Navigator : Button 5 : Scroll Down : Media Previous

       flashLedIndicator(0,0,ColorBlue);
       // PUSH BUTTONS
       if (digitalRead(button1) == button1state) {
          Serial.println("Button 1 - Rally - Volume Up");
          // Sending the command for Trip UP : Volume Up
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_VOLUME_UP); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button2) == button2state) {
          Serial.println("Button 2 - Rally - Volume Down");
          // Sending the command for Trip Down : Volume Down
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_VOLUME_DOWN); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button4) == button4state) {
          Serial.println("Button 4 - Rally - Next Media");
          // Sending the command for Scroll UP : Next Media 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_NEXT_TRACK); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button5) == button5state) {
          Serial.println("Button 5 - Rally - Prev Media");
          // Sending the command for Scroll Down : Prev Media 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_PREVIOUS_TRACK); }
             flashLedIndicator(1,10,ColorBlack);
         }
    } // End softapp 2

    if (softApp == 3) { 

       // App 3 OsMand : Button 1 : Pan UP : Dpad_Up
       // App 3 OsMand : Button 2 : Pan Down : Dpad_Down
       // App 3 OsMand : Button 3 : Centre : 'c'
       // App 3 OsMand : Button 4 : Pan Left : Dpad_Left
       // App 3 OsMand : Button 5 : Pan Right : Dpad_Right

       flashLedIndicator(0,0,ColorBlue);
       // PUSH BUTTONS
       if (digitalRead(button1) == button1state) {
          Serial.println("Button 1 - OsMand - Dpad_Up");
          // Sending the command for Pan UP : Dpad_Up
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_UP_ARROW); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button2) == button2state) {
          Serial.println("Button 2 - OsMand - Dpad_Down");
          // Sending the command for Pan Down : Dpad_Down
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_DOWN_ARROW); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button3) == button3state) {
          Serial.println("Button 3 - OsMand - Keycode_C");
          // Sending the command for Centre : Keycode_C 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('c'); }
             flashLedIndicator(1,10,ColorBlack);
        }
       if (digitalRead(button4) == button4state) {
          Serial.println("Button 4 - OsMand - Dpad_Left");
          // Sending the command for Pan Left : Dpad_Left 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_LEFT_ARROW); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button5) == button5state) {
          Serial.println("Button 5 - OsMand - Dpad_Right");
          // Sending the command for Pan Right : Dpad_Right 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_RIGHT_ARROW); }
             flashLedIndicator(1,10,ColorBlack);
         }
    } // End softapp 3

    if (softApp == 4) { 
      
       // App 4 Piste : Button 1 : Rb Scroll Fwd : w
       // App 4 Piste : Button 2 : Rb Scroll Rev : x
       // App 4 Piste : Button 3 : Trip + : a
       // App 4 Piste : Button 4 : Trip - : d
       // App 4 Piste : Button 5 : Medial Play/Pause : q

       flashLedIndicator(0,0,ColorBlue);
       // PUSH BUTTONS
       if (digitalRead(button1) == button1state) {
          Serial.println("Button 1 - Piste - 'w' key");
          // Sending the command for Rb Scroll Fwd : 'w' key
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('w'); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button2) == button2state) {
          Serial.println("Button 2 - Piste - 'x' key");
          // Sending the command for Rb Scroll Rev : 'x' key
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('x'); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button3) == button3state) {
          Serial.println("Button 3 - Piste - 'a' key");
          // Sending the command for Trip + : 'a' key 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('a'); }
             flashLedIndicator(1,10,ColorBlack);
        }
       if (digitalRead(button4) == button4state) {
          Serial.println("Button 4 - Piste - 'd' key");
          // Sending the command for Trip - : 'd' key 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('d'); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button5) == button5state) {
          Serial.println("Button 5 - Piste - 'q' key");
          // Sending the command for Medial Play/Pause : 'q' key 
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('q'); }
             flashLedIndicator(1,10,ColorBlack);
         }
    } // End softapp 4

    if (softApp == 5) { 
       
       // App 5 Rally Navigator : Button 1 : Fwd scroll : Media Next
       // App 5 Rally Navigator : Button 2 : Rev scroll : Media Previous
       // App 5 Rally Navigator : Button 3 : Trip + : Vol -
       // App 5 Rally Navigator : Button 4 : Trip - : Vol +
       // App 5 Rally Navigator : Button 5 : Lock screen : x

       flashLedIndicator(0,0,ColorBlue);
       // PUSH BUTTONS
       if (digitalRead(button1) == button1state) {
          Serial.println("Button 1 - media next scroll forward");
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_NEXT_TRACK); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button2) == button2state) {
          Serial.println("Button 2 - media previous scroll down");
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_PREVIOUS_TRACK); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button3) == button3state) {
          Serial.println("Button 3 - Volume - trip +");
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_VOLUME_DOWN); }
             flashLedIndicator(1,10,ColorBlack);
        }
       if (digitalRead(button4) == button4state) {
          Serial.println("Button 4 - Volume + Trip -");
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write(KEY_MEDIA_VOLUME_UP); }
             flashLedIndicator(1,10,ColorBlack);
          }
       if (digitalRead(button5) == button5state) {
          Serial.println("Button 5 - Lock screen");
          if (bleKeyboard.isConnected()) {
             bleKeyboard.write('x'); }
             flashLedIndicator(1,10,ColorBlack);
         }
    } // End softapp 5
  } // End of HIGH state button loop
} // End of loop code

void flashLedIndicator(int FlashCount, int FlashDelay, int FlashColor) {
  if (FlashCount == 0) {
     if (FlashColor == ColorBlue) {
        digitalWrite(ledBLUE, HIGH);  // Turn on the blue LED
        digitalWrite(ledRED, LOW); }  // Turn off the red LED
     if (FlashColor == ColorRed) {
        digitalWrite(ledBLUE, LOW);   // Turn off the blue LED
        digitalWrite(ledRED, HIGH); }  // Turn on the red LED
     if (FlashColor == ColorBlack) {
        digitalWrite(ledBLUE, LOW);   // Turn off the blue LED
        digitalWrite(ledRED, LOW); }   // Turn off the red LED
     }  
  else {
     int ledBlueState = digitalRead(ledBLUE);
     int ledRedState = digitalRead(ledRED);
     digitalWrite(ledBLUE, LOW);
     digitalWrite(ledRED, LOW);
     delay (FlashDelay);
     for (int i = 1; i <= FlashCount; i++) {
        if (FlashColor == ColorBlue) digitalWrite(ledBLUE, HIGH);
        if (FlashColor == ColorRed) digitalWrite(ledRED, HIGH);
        delay(FlashDelay);
        digitalWrite(ledBLUE, LOW);
        digitalWrite(ledRED, LOW);
        delay(FlashDelay);
     }
     digitalWrite(ledBLUE, ledBlueState);     
     digitalWrite(ledRED, ledRedState);       
  }
}

void storeSoftApp(int softAppVal) {
  preferences.begin("my-app", false);
  preferences.putUInt("counter", softAppVal); // Use softAppVal instead of counter
  preferences.end();
}

I don't know where to find core board package, this is my first experience with arduino or esp boards...

It's available from the IDE's board manager. Exactly where depends on which version of the IDE you're using. With v1.8.x it's Tools --> Board --> Board Manager

Also, which board have you selected to compile for? Again with With v1.8.x it's Tools --> Board

The following minimalist code compiles for me with ESP32 Core v3.1.1 which is fairly recent.

#include <WiFi.h>
#include <esp_mac.h>

void setup() {
  uint8_t baseMac[6];
  esp_read_mac(baseMac, ESP_MAC_WIFI_STA);
}

void loop() {
}

I was wrong. Remove this and use #include <WiFi.h>.

version of IDE is 2.3.4 and the board is esp 32 wroom DA module

The IDE version is not the same as the ESP32 Arduino Core version. I don't use IDE 2.x, so I can't tell you where to find that info. But it would behoove you to find out. Knowing the Core version is much more important with ESP32 than with other platforms as there can be significant changes to the API calls between different versions.

What happened when you tried my code from Post #14?

Your code can be easily upload to the board.
Chip is ESP32-D0WD-V3 (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 5c:01:3b:72:f0:44
Some info about board...

This detailed logfile will contain all the information that is needed to analyse the error

Why did you put #include <esp_mac.h> inside that preprocessor conditional compilation clause? Move it to right under #include <WiFi.h>. Also, delete #include "esp_wifi.h", you don't need it at all.

I made it as you told me and there are still lot of warnings, maybe it is due to some libraries...

In file included from c:\Users\juraj\Documents\Arduino\libraries\ESP32_BLE_Keyboard\BleKeyboard.cpp:14:
C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\tools\esp32-arduino-libs\idf-release_v5.4-2f7dcd86-v1\esp32/include/driver/deprecated/driver/adc.h:19:2: warning: #warning "legacy adc driver is deprecated, please migrate to use esp_adc/adc_oneshot.h and esp_adc/adc_continuous.h for oneshot mode and continuous mode drivers respectively" [-Wcpp]
   19 | #warning "legacy adc driver is deprecated, please migrate to use esp_adc/adc_oneshot.h and esp_adc/adc_continuous.h for oneshot mode and continuous mode drivers respectively"
      |  ^~~~~~~
c:\Users\juraj\Documents\Arduino\libraries\ESP32_BLE_Keyboard\BleKeyboard.cpp: In member function 'void BleKeyboard::begin()':
c:\Users\juraj\Documents\Arduino\libraries\ESP32_BLE_Keyboard\BleKeyboard.cpp:105:19: error: cannot convert 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'String'
  105 |   BLEDevice::init(deviceName);
      |                   ^~~~~~~~~~
      |                   |
      |                   std::string {aka std::__cxx11::basic_string<char>}
In file included from c:\Users\juraj\Documents\Arduino\libraries\ESP32_BLE_Keyboard\BleKeyboard.cpp:7:
C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLEDevice.h:41:27: note:   initializing argument 1 of 'static void BLEDevice::init(String)'
   41 |   static void init(String deviceName);                                                            // Initialize the local BLE environment.
      |                    ~~~~~~~^~~~~~~~~~
c:\Users\juraj\Documents\Arduino\libraries\ESP32_BLE_Keyboard\BleKeyboard.cpp:116:32: error: no matching function for call to 'BLECharacteristic::setValue(std::string&)'
  116 |   hid->manufacturer()->setValue(deviceManufacturer);
      |   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLEServer.h:23,
                 from C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLEDevice.h:21:
C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLECharacteristic.h:79:8: note: candidate: 'void BLECharacteristic::setValue(uint16_t&)'
   79 |   void setValue(uint16_t &data16);
      |        ^~~~~~~~
C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLECharacteristic.h:79:27: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'uint16_t&' {aka 'short unsigned int&'}
   79 |   void setValue(uint16_t &data16);
      |                 ~~~~~~~~~~^~~~~~
C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLECharacteristic.h:80:8: note: candidate: 'void BLECharacteristic::setValue(uint32_t&)'
   80 |   void setValue(uint32_t &data32);
      |        ^~~~~~~~
C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLECharacteristic.h:80:27: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'uint32_t&' {aka 'long unsigned int&'}
   80 |   void setValue(uint32_t &data32);
      |                 ~~~~~~~~~~^~~~~~
C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLECharacteristic.h:81:8: note: candidate: 'void BLECharacteristic::setValue(int&)'
   81 |   void setValue(int &data32);
      |        ^~~~~~~~
C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLECharacteristic.h:81:22: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'int&'
   81 |   void setValue(int &data32);
      |                 ~~~~~^~~~~~
C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLECharacteristic.h:82:8: note: candidate: 'void BLECharacteristic::setValue(float&)'
   82 |   void setValue(float &data32);
      |        ^~~~~~~~
C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLECharacteristic.h:82:24: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'float&'
   82 |   void setValue(float &data32);
      |                 ~~~~~~~^~~~~~
C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLECharacteristic.h:83:8: note: candidate: 'void BLECharacteristic::setValue(double&)'
   83 |   void setValue(double &data64);
      |        ^~~~~~~~
C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLECharacteristic.h:83:25: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'double&'
   83 |   void setValue(double &data64);
      |                 ~~~~~~~~^~~~~~
C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLECharacteristic.h:77:8: note: candidate: 'void BLECharacteristic::setValue(uint8_t*, size_t)'
   77 |   void setValue(uint8_t *data, size_t size);
      |        ^~~~~~~~
C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLECharacteristic.h:77:8: note:   candidate expects 2 arguments, 1 provided
C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLECharacteristic.h:78:8: note: candidate: 'void BLECharacteristic::setValue(String)'
   78 |   void setValue(String value);
      |        ^~~~~~~~
C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE\src/BLECharacteristic.h:78:24: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'String'
   78 |   void setValue(String value);
      |                 ~~~~~~~^~~~~
Using library ESP32 BLE Keyboard at version 0.3.0 in folder: C:\Users\juraj\Documents\Arduino\libraries\ESP32_BLE_Keyboard 
Using library BLE at version 3.2.0 in folder: C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\BLE 
Using library Preferences at version 3.2.0 in folder: C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\Preferences 
Using library WiFi at version 3.2.0 in folder: C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\WiFi 
Using library Networking at version 3.2.0 in folder: C:\Users\juraj\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.2.0\libraries\Network 
exit status 1

Compilation error: exit status 1