Usb Mouse Control not work :( HELP PLEASE

Hello there . I'm very new to Arduino. As long as I press the right button of my mouse connected to my computer via USB, I want it to type the number 5 from the keyboard. I was able to do this with NumLock without using any pins, but I cannot do it with the right mouse button. Can you help with a simple explanation?

Example my code now =

#include <HID-Project.h>
void setup() {
Keyboard.begin();
Mouse.begin();
}
void loop() {
if (BootKeyboard.getLeds() & LED_NUM_LOCK) //Mouse.İsPress now work :frowning:
{
Keyboard.press('5');delay(100);Keyboard.release('5');delay(100);
}
}

Please Help me

Just to check that I understand what you are trying to do

  • The Arduino (which board do you have) is connected to the PC via a USB port
  • The mouse is connected to the PC
  • When you click the right button of the mouse you want the Arduino to send the '5' character as if it had been typed on the PC keyboard
  • the sketch that you posted sends a '5' to the PC when you click the left mouse button

Is that correct ?

Hi My card Arduino Leonardo .
I want example :
if Mouse Right Button Press ;
keyboard.press('5')

Please confirm that the mouse is connected to the PC

Yes Mouse Connected to the PC

In order for the Arduino to detect a click on a mouse connected to the PC there needs to be some software running on the PC to pass it to the Arduino. Do you have such software installed ?

No . Only Arduino İDE software running .
I want the fee connected to my computer via usb to press the numbers 5 from the time path in my list on the right. detects capslock led but not mouse detect :frowning:

I'm sorry, but you have completely lost me except for the fact that the only application running on the PC is the Arduino IDE

For example, what are you using?

I am not using anything as I have never needed to pass a click from a mouse connected to the PC to the Arduino

This is the most amazing XY Problem I have seen so far!