Jump to content

I need help with some stuff

Poodros

Hello everyone, my name is Daniel and I'm a College student into a Programming course.

There, presentation handled. Now the actual thing

This semester we're working with Arduino and I got a Project in mind for my last semester.

Basically is making kind of a play/pause controller for music/video files(independent of it is either a file on your computer or if it is running in something like Spotify, QuickTime, GOM, YouTube, etc...) for your desktop computer/laptop, whatever.

I need help with:

- How do i refer to the play/pause function?

I will accept any help i get from here

Thanks in advance

Link to comment
Share on other sites

Link to post
Share on other sites

What exactly do you mean by "refer to play/pause function"?

 

If you mean "how to trigger play/pause programmatically", you can try using AutoHotkey (https://www.autohotkey.com).

 

Assuming you have Windows, a quick setup could be something like: 

1. The Arduino runs a simple piece of code that simply detects a physical button press. Once the button is pressed, it sends a message to serial output via `Serial.print`

2. On the computer, you run a simple Python script that listens to the the serial (using python's builtin `serial` module), and triggers an autohotkey script when a message arrives from the arduino.

3. The autohotkey script emulates a press of the media play/pause key (`Send {Media_Play_Pause}`).

 

This should work in all the desktop apps that properly handle the media key presses. Unfortunately it's not trivial to make it work in the general case. For example, it  will NOT work with youtube as it does not handle the media keys. You will likely have to implement specific hacks if a particular app you want to support doesn't handle media keys.

 

EDIT: forgot to mention that all of this assumes that your arduino is going to be connected to the computer via USB. Other methods of communication will be more involved.

Link to comment
Share on other sites

Link to post
Share on other sites

The arduino might not be that well suited to interacting with a PC for a beginner project.
You'd likely have to write drivers for your computer to understand what you're sending to it or you'd have to emulate an existing peripheral.

I'd advise making a robot or generating your own noise.
I took a class with Arduinos being used & that was in conjunction with a DC electronics course as they tie in together very well as that's half of what the arduino needs to function.

Do you have electronic knowledge on the Voltage, amplitude, KVM, resistance, kinda level? If not, I'd seek out some resources for learning about that so you can design a circuit for your Arduino to interact with.

 

Interacting with windows on a hardware level is a bit of an advanced subject if I'm not mistaken. It may be possible though. Microsoft has standard drivers & "plug & play."

Link to comment
Share on other sites

Link to post
Share on other sites

31 minutes ago, fpo said:

The arduino might not be that well suited to interacting with a PC for a beginner project.
You'd likely have to write drivers for your computer to understand what you're sending to it or you'd have to emulate an existing peripheral.

I'd advise making a robot or generating your own noise.
I took a class with Arduinos being used & that was in conjunction with a DC electronics course as they tie in together very well as that's half of what the arduino needs to function.

Do you have electronic knowledge on the Voltage, amplitude, KVM, resistance, kinda level? If not, I'd seek out some resources for learning about that so you can design a circuit for your Arduino to interact with.

 

Interacting with windows on a hardware level is a bit of an advanced subject if I'm not mistaken. It may be possible though. Microsoft has standard drivers & "plug & play."

For specifically his project it's not that complicated. All he need to do is emulate a keyboard keycode. Some multimedia keyboard have already play/pause keys that sends to windows a specific keycode that handle that. But it doesn't work with everything. Windows Media Player, VLC, Youtube fine but last time i check it didn't work on spotify and winamp.

Link to comment
Share on other sites

Link to post
Share on other sites

Just tested on my current keyboard plugged in and the keycode you want if it's the solution route you want to go is this :

 

image.png.114c9d3b0cf604fce8f9e569c2d4dfd8.png

 

You can try different keyboard here https://keycode.info/

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×