Windows volume controller with potentiometer

Hi,

My speakers have individual volume control knob on the back of each and i have to adjust the general volume by windows. I really miss the knob and i want to make one with arduino. I want to use arduino and a potentiometer to control the Windows volume over the usb. I found on the internet the code but its use a rotary encoder and i don't have one now.

I manage to read the potentiometer with this code but i dont know how to make it manipulate the windows volume according to the pot value

int sensorPin = A0;
int sensorValue =0;

void setup() {
Serial.begin(9600);
}

void loop() {
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
delay(100);
}

Here its the code for rotary encoder: Add a Mute Button | Trinket USB Volume Knob | Adafruit Learning System

Anyone can help me please?

You mean here is the code for a rotary encoder:

That code just processes the Rotary Encoder, so you don't really need any of that.

But, the first line is this:
#include "TrinketHidCombo.h"

and then they manipulate the volume using calls in the code like this:

TrinketHidCombo.pressMultimediaKey(MMKEY_VOL_UP);
TrinketHidCombo.pressMultimediaKey(MMKEY_VOL_DOWN);

and then finally, this:
TrinketHidCombo.poll(); // check if USB needs anything done

So, you need to look at their TrinketHidCombo library:

arduinodlb:
You mean here is the code for a rotary encoder:

Add a Mute Button | Trinket USB Volume Knob | Adafruit Learning System

Yes, thank you.

The code you have there, would work with very little refinement. You just need an app on the Windows side to read the serial port and change the volume. But that is really a Windows programming problem, not an Arduino programming problem. Try posting in a Windows related forum.

I saw on the code for rotary encoder they dont use any windows side program, they use TrinketHidCombo.pressMultimediaKey() function and i thought something similar its possible using a pot instead of a rotary decoder.

Leo7:
I saw on the code for rotary encoder they dont use any windows side program, they use TrinketHidCombo.pressMultimediaKey() function and i thought something similar its possible using a pot instead of a rotary decoder.

Yes it is. Reread my post #1.