Control the frequency in SDR# with a rotary encoder. From the tutorial http://eartoearoak.com/tutorials-and-examples/sdrsharp-physical-controls
/* | |
Basic example demonstrating the how to control SDR# frequency | |
with SDRSharp Net Remote, an Arduino and rotary encoder. | |
Copyright 2015 Al Brown | |
Requires: | |
http://eartoearoak.com/software/sdrsharp-net-remote | |
http://www.pjrc.com/teensy/td_libs_Encoder.html | |
Connections: | |
Encoder Arduino | |
A D3 | |
B D2 | |
C GND | |
This program is free software: you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by | |
the Free Software Foundation, or (at your option) | |
any later version. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of | |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
GNU General Public License for more details. | |
You should have received a copy of the GNU General Public License | |
along with this program. If not, see <http://www.gnu.org/licenses/>. | |
*/ | |
#include <Encoder.h> | |
// Initialise the encoder on digital pins 2 & 3 | |
Encoder encoder(2, 3); | |
long oldPos = -999; | |
// Initial frequency | |
long frequency = 100000000; | |
void setup() { | |
Serial.begin(115200); | |
} | |
void loop() { | |
// Get the encoder position | |
long newPos = encoder.read(); | |
if (newPos != oldPos) { | |
oldPos = newPos; | |
// Send the command to change the frequency via the serial port | |
Serial.print("{\"Command\": \"Set\", \"Method\": \"Frequency\", \"Value\": "); | |
Serial.print(frequency + (newPos * 1000)); | |
Serial.println("}"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment