HID for Arduino Uno R3 and uploading the code

Hi there, i’m new here. I have arduino uno R3 and i’ve ‘upgrade HID firmware’. In arduino IDE, when i choose ‘Board: Arduino Leonardo’, the can compile when include the mouse.h, but when i choose ‘Board: Arduino Uno’, the code can’t be compile. is it okay if i uploading the code using leonardo as board choice? my project need to control mouse using accelerometer. thank in advanced.

That's not how it works. The Arduino Leonardo is a completely different board with a different microcontroller on board. The Arduino Uno's MCU doesn't support USB, the Leonardo's does. It won't work.

You could use custom firmware on the ATmega16U2 to act as an HID device, but I wouldn't recommend it if you're a beginner.

Pieter

thank you for replying this post. i have use the custom firmware ATmega16u2 for my arduino uno. my problem is how to upload coding to my arduino uno using IDE? i can't upload coding as the error say that ''mouse.h not found'

You have to use a different mouse library that works with the firmware you're using.

i'll give a try.. thanks for the response sir..

Once you have changed the firmware in the 16u2 you can no longer load code through the IDE. That is what makes using it tricky.
So you have to either restore the origional 16u2 bootloader code or program the processor with an ISP. You can use another Arduino as a ISP, the program is in the IDE.

thanks.. i'll try it..