well, there’s been some small progress…. I started tinkering with the rotary encoder.
I found a great example here: http://www.pjrc.com/teensy/td_libs_Encoder.html
one thing, though – encoder.h must be added to the Arduino Libraries folder
/* Encoder Library - TwoKnobs Example
* http://www.pjrc.com/teensy/td_libs_Encoder.html
* This example code is in the public domain.
*/
#include <Encoder.h>
//Copal RMS20-250-201-1G Encoder:
//RED = 5VDC
//White = Output A
//Brown = Output B
//Black = Ground
Encoder knobLeft(2, 4);
void setup()
{
Serial.begin(9600);
Serial.println("Encoder Test:");
}
long positionLeft = -999;
void loop()
{
long newLeft;
newLeft = knobLeft.read();
if (newLeft != positionLeft)
{
Serial.print("Left = ");
Serial.print(newLeft);
Serial.println();
positionLeft = newLeft;
}
if (Serial.available())
{
Serial.read();
Serial.println("Reset both knobs to zero");
knobLeft.write(0);
}
}
now, the next challenge is determining how to dynamically tune the radio, based on how quickly the knob is spinning. I think the trick here is going to be to perform some timing measurements – using millis() or micros() to measure the average time between pulses while I’m spinning the knob at some (arbitrary) rates that I feel afre appropriate…