Skip to content

Instantly share code, notes, and snippets.

@arodland
Last active February 5, 2018 06:03
Show Gist options
  • Save arodland/962a2b4ea947e7057d5ba49bb13e0e33 to your computer and use it in GitHub Desktop.
Save arodland/962a2b4ea947e7057d5ba49bb13e0e33 to your computer and use it in GitHub Desktop.
void loop() {
ritval = analogRead(ritPin);
cwoffset = digitalRead(4);
unsigned long vfo = freq; // Start with the dial frequency
if (cwoffset) {
vfo += 800; // +800Hz CW shift
}
vfo += (ritval - 512) * 10; // About a +/- 5kHz range
if (vfo != freqOld) {
AD9833setFrequency(vfo, SINE);
freqOld = vfo;
}
// That's all, folks
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment