Take the 2-minute tour ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

Can I code my Arduino to open a file when an input from my sensor changes?

share|improve this question

closed as too broad by Nick Gammon, Gerben, LoganBlades, Ricardo, TheDoctor Aug 13 at 15:47

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs. If this question can be reworded to fit the rules in the help center, please edit the question.

2 Answers 2

up vote 0 down vote accepted

Sort of yes,
you can turn your Arduino into USB keyboard and fire some keystrokes ([win]+[r] notepad [enter]), or entire program (e.g. BAT file or .sh). I didn't had time to play with it, but it should work.

sources:
http://hackaday.com/2012/06/29/turning-an-arduino-into-a-usb-keyboard/
and
https://code.google.com/p/vusb-for-arduino/

good luck!

share|improve this answer

Sort of; You can code your arduino to send a message to a program running on your computer that opens the file. It cannot directly issue commands on your computer. Using serial to communicate is the most common way to get a message across.

The program on your computer could be written in just about anything; all it needs to do is open a serial port, wait for a message, and then open a program. Use whatever you are comfortable with.

share|improve this answer
    
Can you give me an outline of the code? I will use python to open a file. but how do code arduino to open that open that python file? –  Roche Periyanayagam Jul 19 at 8:57
1  
@RochePeriyanayagam You need to learn how to use the serial port in python. The Arduino sends a message (of your choosing) through its serial connection (USB) and the python script receives it, works out what it means (again up to you) and does something depending on what the received message is. There's thousands of examples on the web. –  Majenko Jul 19 at 10:54
    
@RochePeriyanayagam we can help you, but we can't write a whole program for you, and with such a broad question, it's hard to even help. –  TheDoctor Aug 13 at 15:54

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