What I try to do is run C / C ++ code on arduino for the computer eg use of C ++ libraries and run this C ++ code on the computer
An example create a file on the computer with C ++:
#include
#include
std::ofstream outfile ("test.txt");
outfile << "my text here!" << std::endl;
outfile.close();
What I want is that when connecting the arduino can execute "Automatically" this code in the computer Is there any way to be able to perform this action?
I want create files in the "Computer" not in the Arduino
If you want something to happen on your PC when an Arduino is connected you will need to have a program running on the PC that continually checks whether the Arduino is connected.
An Arduino cannot cause a program to run on a PC.
Perhaps one exception to that is if a Leonardo or Micro is programmed to act as a keyboard in which case it could send keystrokes to the PC which might be capable of causing it to do what you want. Check out the keyboard capabilities
...R
Robin2:
If you want something to happen on your PC when an Arduino is connected you will need to have a program running on the PC that continually checks whether the Arduino is connected.
An Arduino cannot cause a program to run on a PC.
Perhaps one exception to that is if a Leonardo or Micro is programmed to act as a keyboard in which case it could send keystrokes to the PC which might be capable of causing it to do what you want. Check out the keyboard capabilities
...R
Arduino execute code in the computer when connection with the usb, ¿why not is possible?
Are you wanting a USB Rubber Ducky?
How can Arduino code execute in a computer?
Arduino code is compiled for an Atmega microprocessor - not for the processor on your PC.
This is all just a waste of time. You need to explain what your project is all about.
...R
The library Keyboard and Mouse execute code in the computer...
No they do not. The code running on the Arduino communicates with the computer over the USB connection according to a defined protocol (USB-HID). The computer accepts and interprets these messages and performs the appropriate action according to the protocol spec.
Everything that happens with the Keyboard and Mouse library happens because the computer allows it to. If you program the computer to ignore the Arduino (like disabling the device in Device Manager), there is nothing the Arduino can do to make it listen.
You have been told what you need to do. If you want a PC program to run when the Arduino is plugged in, you need to write code on the PC in addition to the Arduino, because the PC is in control of itself.