Monday, February 26, 2024

Simple Arduino rotary tuning knob for SDR

I like using SDR++ to remote control my AirSpy receiver but I was missing the tuning knob. SDR++ can be tuned with the mouse wheel but I find it a bit difficult.

Using an Arduino UNO R4 Minima I've made a very simple Rotary encoder that sends left or right arrow keys to the computer. I can't get the interrupt driven encoder code to work so I'm just polling but it seems fine for me. 


Soon I'll box it up for desktop use.

Embarrassingly little code is needed for this.

#include <Keyboard.h>
#include <Rotary.h>

Rotary r = Rotary(2, 3);

void setup() {
Keyboard.begin();
r.begin(true);
delay(1000);
}

void loop() {
unsigned char result = r.process();
if (result) {
if(result == DIR_CW) {
Keyboard.press(KEY_RIGHT_ARROW);
delay(10);
Keyboard.releaseAll();
} else {
Keyboard.press(KEY_LEFT_ARROW);
delay(10);
Keyboard.releaseAll();
}
}
}

Here it is all boxed up like a bought one:



No comments:

Post a Comment