about arduino ( esp32 ) Android keystroke " Plus "

Hello Guys,

It's been 2 days that I try to send in bluetooth serial, the command KEYCODE_PLUS (81) (0x51) between my ESP32 card to my Android phone. I am using the ESP32-BLE-Keyboard library in the arduino IDE.

When i use this command on the sketch :

    bleKeyboard.write(KEY_ZOOM_OUT); //

I receive 69 on the smartphone . and it's OK

On the Blekeyboard.h file i've added this :

const uint8_t KEY_ZOOM_OUT = 0xDE;

And the part of my sketch :

if (Serial.available() > 0) {
  // read the incoming byte:
  incomingSerial = Serial.read();
  Serial.println(incomingSerial);
 
    if ( incomingSerial == 49) {
bleKeyboard.write(KEY_ZOOM_OUT); // keycode to send 0xDE - 0x45 on Smartphone side - work ok
  }
  else if ( incomingSerial == 50) {
bleKeyboard.write(KEY_ZOOM_IN); // keycode ?????? - 0x51 needed on Smartphone side 
  }
}

Who has ever managed to solve a problem like this?

Thank you in advance

Please post your code

Please follow the advice on posting code given in Read this before posting a programming question

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless

If the code exceeds the 9000 character inline limit then attach it to a post

UKHeliBob:
Please post your code

Please follow the advice on posting code given in Read this before posting a programming question

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here as it prevents some combinations of characters in code being interpreted as HTML commands such as italics, bold or a smiley character, all of which render the code useless

If the code exceeds the 9000 character inline limit then attach it to a post

thanks for the reminder, is it ok now ?

is it ok now ?

I can only see 2 isolated lines of code

What about the rest of the sketch ?

the sketch is very big with multiple pages

this will possibly help :

if (Serial.available() > 0) {
  // read the incoming byte:
  incomingSerial = Serial.read();
  Serial.println(incomingSerial);
  
    if ( incomingSerial == 49) { 
bleKeyboard.write(KEY_ZOOM_OUT); // keycode to send 0xDE - 0x45 on Smartphone side - work ok
  }
  else if ( incomingSerial == 50) { 
bleKeyboard.write(KEY_ZOOM_IN); // keycode ?????? - 0x51 needed on Smartphone side  
  }
}

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