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() {
void loop() {
if (BootKeyboard.getLeds() & LED_NUM_LOCK) //Mouse.İsPress now work :frowning:

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 ;'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!

Help me :confused:

If this is true

then how do you suppose that the PC could send anything to the Arduino as a result of a mouse click

Perhaps if you were to explain exactly what you are trying to achieve rather than how you think that it might work then it might help

Explain what actions user will do and what happens on the PC and Arduino as a result

As in #12, that is what is called the "XY Problem". :grin:

Hence my request for clarification

For me, it seems to be quite clear what OP wants / needs. A mouse press on the PC arrives (in some way) in the Arduino and the Arduino sends a character.

That first part would be similar to the getLeds() method which (I think) interrogates the PC. I do not know enough about USB (read: nothing) to be able to say if the first part is possible without additional software on the PC.

Now the question is why the OP wants to use an Arduino to achieve this. It would be a million times easier to detect a mouse press in software on the PC and and let that software type the character (e.g. on the screen).

Hello, my requests are very clear and precise. Reading is also clear in the codes I have forwarded. Not only with the control capslock that will start and stop the keypress, the mouse right click will sound that's all.

Example ;

İf MouseRightClickButton Press ; // ( I can't find the correct code )

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