Arduino
例子:
-
https://www.arduino.cn/thread-81606-1-1.html
-
https://blog.csdn.net/ShenZhen_zixian/article/details/121659482
- ``https://blog.csdn.net/ShenZhen_zixian/article/details/121632209
Arduino Uno 的 ATMega328p芯片不支持模拟USB外设。如果要用Arduino模拟USB外设 (如键盘、鼠标、手柄等)要用ATMega32U4芯片的 Arduino Leonardo板子才行。
The only way to use Mouse.h on an Arduino is to use it on a compatible Arduino. You cannot "convert" an Uno into a Leonardo, since you would have to not only replace the MCU on the board (with one that is SMD only), you would have to replace the PCB itself as well. I.e., throw away the Uno and replace it with a Leonardo.
The Mouse.h (and Keyboard.h) requires an MCU with a built-in USB interface, such as the ATMega32U4 that the Leonardo has. The ATMega328p does not have such an interface (note: the "U" in the name kind of gives it away...).
However, all is not lost. The Uno does have a chip on it with a "U" in the name (as long as it's a genuine Arduino board and not a cheap Chinese clone with a CH340G chip). That chip, used to interface the ATMega328p to the PC through USB, can be reprogrammed to look like different devices, however doing so can break your ability to then program the Arduino itself.
You can read more about hacking your Arduino to be a mouse here.