Question

Hi, I'd like to use a Leonardo to run a macro on my pc. I undestand that arduino boards work independently from pcs, so i was wondering if it was possible for the pc to recognize that it is the Leonardo that is running the macro, and not a human. thanks anand

The Leonardo works just like an ordinary HID keyboard. The Leonardo also appears as a virtual COM port and has a VID/PID that identify it as an Arduino Leonardo. It's possible to change that but it's a bit more advanced of a process.

Thanks for reply. Ok i understand that the pc can recognize that it is a Leonardo, but is it possible for it to understand that it is executing code and sending mouse and keyboard input automatically?

amadeok: Thanks for reply. Ok i understand that the pc can recognize that it is a Leonardo, but is it possible for it to understand that it is executing code and sending mouse and keyboard input automatically?

The Leonardo cannot send code to a PC. It can only send keystrokes. You could use those keystrokes to cause a program stored on the PC's hard disk to run.

I suspect if the Leonardo is configured as a keyboard that the PC will just identify it as a keyboard not as a Leonardo (but I may be wrong).

...R

is it possible for it to understand that it is executing code and sending mouse and keyboard input automatically?

No.