1
\$\begingroup\$

I am doing an electronics project for school. I need the Arduino on request from a button to communicate to the computer to open a media file. This is to help a deaf person be able to play his DVDs without having to put them in the DVD player as he is mostly blind.

Any help will be greatly appreciated.

\$\endgroup\$

4 Answers 4

10
\$\begingroup\$

You should probably use serial communication. When the person presses the button, the arduino will send a command through serial to the computer. You will have to create a program on the computer that listens for that serial command, and upon receiving it, launches the program to play the media file.

\$\endgroup\$
3
\$\begingroup\$

gobetwino (also on GitHub) is software for the PC that responds to various serial requests from the Arduino such as "open file on the PC", "open internet web file", etc.

\$\endgroup\$
2
\$\begingroup\$

As Ryan says, you will have to create a program on the Computer to launch and play the media file. If its the same file every time then it would be not so difficult. However if the Arduino has to make a selection on the file, then it gets a little bit more interesting to implement.

\$\endgroup\$
0
\$\begingroup\$

Install Python on the computer then install pySerial at the command prompt. Change your video file location below and then paste this code in the Python command window and press enter. On the Arduino press a GPIO connected button and the video will start.

import serial, os, time, serial.tools.list_ports

cmd = '"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\VideoLAN\clocks.mp4" -f --play-and-exit'
ser = serial.Serial(port, 9600, timeout=0)
for p in serial.tools.list_ports.comports():
  sp = str(p)
  if (sp.find('Arduino') != -1):
    flds = sp.split()
    port = flds[0]
    print (port)

ser = serial.Serial(port, 9600, timeout=0)

while 1:
  try:
    line = ser.readline()
    if (line):
      print (cmd)
      os.system(cmd)
  except:
    pass
  time.sleep(1)
\$\endgroup\$
1
  • 2
    \$\begingroup\$ paul matthew - Hi, Thanks for trying to help. (a) Can you edit your answer to explain what code needs to be running on the Arduino, for that Python code (on the PC) to work as you describe? At the moment, it doesn't say anything about the Arduino, yet some code is needed on the Arduino too. (b) If you are using information from somewhere else as a source for this technique & code, please add a link to that webpage (etc.) to comply with the Stack Exchange requirement to reference sources. Thanks. \$\endgroup\$
    – SamGibson
    Commented Feb 24, 2023 at 22:25

Your Answer

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