I wonder if in Arduino you can modify the computer eg create a text file inside the computer using Arduino. Is there any way you can do this or something like that?

Because you can use the library #include <stdio.h>, which is a C++ language library to handle file on the computer.

In Arduino maybe you can create files on the computer using pointers or a library? Because using the library "Keyboard.h" you can handle the computer. The Keyboard library can interact with the computer by typing on the computer

I'm in doubt, I need your knowledge.

  • You can do it with a Serial.print if there is a program on the computer ready to accept the input from the serial port.
    – SDsolar
    Jun 6, 2017 at 23:02
  • But to be clear, that requires writing a program on the computer to listen for the signal from the Arduino and actually do the work. The Arduino cannot command the computer by itself. All it could do would be to send a signal to let the computer know it was time to do it.
    – Delta_G
    Jun 6, 2017 at 23:18

3 Answers 3


The arduino can't directly modify the contents of the PC hard drive, the ability for a peripheral device to do this would be considered a massive security flaw in the PC operating system.

Having said that there are a few ways to do it:

To save a text file without anything special on the PC:
Have the Arduino act as a keyboard. Send (windows key + R) (pause) notepad < enter > (pause) [ The text you wish to save to the PC ] (alt-f) s < file name > < enter>
This does require the PC to be unlocked (or you send the unlock key sequence first) and setting the directory to save to or overwriting a file could get tricky but should be possible if you work out the correct key sequence. The (windows key + r) combination is very powerful and also very dangerous. It makes it trivial to wipe the entire computer so use it with care.

To save a binary file to the PC:
Set up the arduino to act as a serial port. Start the terminal program of your choice and set it to log to a file. Send the data from the arduino. On the PC wait until the transfer is complete and then save the log file.

To read/save/modify any file without user interaction:
Set up the arduino to act as a serial port. Write a desktop PC application that takes the data from the Arduino. Define a protocol that allows the arduino to to specify the filename and what to do with it. The arduino doesn't directly access any files, instead it sends the commands to an application running on the PC, that application then performs the required file operations.

Alternative way to read/save/modify any file without user interaction:
Connect the arduino to the PC using USB. Exploit a flaw in the PC operating system to install a virus on the PC that gives you full control over the computer.


The keyboard library just sends key presses to the computer like a keyboard. From the PCs point of view it's no different from you banging on the keyboard in front of it. The Arduino can't control anything on the computer and it can't run any code on the computer. Now if you can do what you want completely from the keyboard then arduino could send those same keypresses. But the Arduino has no access to the PCs operating system or file system.


There are a number of serial-terminal programs that run on your PC (and pretty much any OS) that will copy the data they receive to a file. I use CoolTerm on MacOS. I think Windows HyperTerminal offers that capability as well on Windows. You have to start the terminal program on the PC, set it to capture, and open the capture file yourself - the Arduino can't cause the PC to do that - but once you've done it, the terminal program will copy all output from the Arduino to the capture-file. You might also have to set the PC to not sleep, if you need it to capture data without you being present.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.