I am new to the Aurdino and have lots to learn. I am working on project to mute my windows speaker when RF if detected in a nearby coax. Lot's of hams listen to remote SDR receivers but have to click their speakers off and on during a transmission. I would like to do this automatically. I have the RF sniffer circuit working and having it pulling a pin low. The code is about the begin and looking for any examples. Just need to turn the audo off when pin is pulled low and turn it back on when pin goes high. May need to add some delay timers for lulls in speech but I can work that out hopefully. Thank you for taking a look and look forward to suggestions or example code.
Welcome to the forum
Is there a Windows keystroke to mute and unmute the sound
I can think of a lot of ways of doing that but without knowing how your system is set up and what parts I can spend weeks guessing. Post a block diagram showing the system. What determines a low or high to control the computer?
For conversation purposes let's just say it's a pushbutton. I want to push the button and sound would go off. When I release it I want the sound to come back on. This would be with an Aurdino plugged into the USB port. That's the best way to describe it.
That does not mention how you intend to modify your PC in order to make this work.
An Arduino Micro or other Arduino with "native USB" feature can send mute/unmute commands to the PC by acting as a "Consumer" HID device.
No modification the the PC except inserting the USB.
Can you tell me where I can find more info on this "Consumer" HID device ? Things like intruction set ? Examples ?
Hello northedistoriverman
Take a search engine of your choice and ask the WWW for 'HID device +arduino'.
If it's just like a pushbutton, then an Arduino Leonardo or Micro can act as a keyboard and send a mute command when pressed. No PC modifications needed. Just detect the button press and trigger the mute shortcut in Windows.
Instruction set and examples are on the link I posted. Explore it.
I have a sound app that appears at the bottom of all windows that I click on and can adjust the volume, source, destination, etc. It also allows me to turn on and off the sound at will. I would assume Windoz has something similar, I am running Linux cinnamon.
Thank you Paul. Being new I did not realize there was a link. Will take a look.
Hi again Paul,
Can a attiny85 handle this ? It has an onboard port that is USB but don't know if you can push commands through it.
Craig
I hear you've read the datasheet ![]()
Probably not.
The HID library I linked to doesn't show attiny85 in the list of compatible boards.
I continue to get closer. I have the attiny85 sending keystrokes via the USB but I've yet to get it to mute my sound which is the goal. Here partial of the code. Do I have the correct mute hex code ?
#include <TrinketKeyboard.h>
#define KEYCODE_MUTE 0x7F
int led = 1;
void setup()
{
pinMode(led, OUTPUT);
// start USB stuff
TrinketKeyboard.begin();
// Assuming you've got a power LED on pin 1, this is to see whether the keyboard is active.
// Simply press Reset if you want to re-run.
digitalWrite(led, HIGH);
TrinketKeyboard.poll();
// Wait for 5ms, to ensure that keypresses aren't lost
delay(5);
TrinketKeyboard.pressKey(0,KEYCODE_MUTE);
TrinketKeyboard.pressKey(0,0);
digitalWrite(led, LOW);
}
@northedistoriverman this link might interest you.
I looked at the codes of a couple of different keyboards and the mute code I got seemed to differ a little but they all seemed to fall in the 0xe0 to 0xef range which appear in the link I shared as KEY_MEDIA values. I am not sure this will work on your setup and even the OS may make a difference but I would try each of the 16 values in turn and see if it mutes
Ok, will wait until you have posted full code.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.