Hello,
I'm working on a realtime effects processor (delay and reverb) using the teensy audio board.
I have two pots to change delay and reverb parameters using analogRead() on two pins. So far so good.
Currently I use a function to read the values which is called periodically in the loop() function. Is there a way to convert it to some kind of interrupt to save processing time? Is this necessary? I only want to change the actual variables if the input value change by 10, because i don't need the full precision of analogRead(). Here is how I did it now:
float dly = 0;
float rev = 0;
void readValues(void) {
short dly_tmp = analogRead(3);
if (dly > dly_tmp) {
if ((dly - dly_tmp) > 10)
dly = dly_tmp;
} else {
if ((dly_tmp - dly) > 10)
dly = dly_tmp;
}
short rev_tmp = analogRead(2);
if (rev > rev_tmp) {
if ((rev - rev_tmp) > 10)
rev = rev_tmp;
} else {
if ((rev_tmp - rev) > 10)
rev = rev_tmp;
}
}
I also found this library:
https://github.com/merose/AnalogScanner
Maybe this is suitable for me?
Thanks
I'm working on a realtime effects processor (delay and reverb) using the teensy audio board.
I have two pots to change delay and reverb parameters using analogRead() on two pins. So far so good.
Currently I use a function to read the values which is called periodically in the loop() function. Is there a way to convert it to some kind of interrupt to save processing time? Is this necessary? I only want to change the actual variables if the input value change by 10, because i don't need the full precision of analogRead(). Here is how I did it now:
float dly = 0;
float rev = 0;
void readValues(void) {
short dly_tmp = analogRead(3);
if (dly > dly_tmp) {
if ((dly - dly_tmp) > 10)
dly = dly_tmp;
} else {
if ((dly_tmp - dly) > 10)
dly = dly_tmp;
}
short rev_tmp = analogRead(2);
if (rev > rev_tmp) {
if ((rev - rev_tmp) > 10)
rev = rev_tmp;
} else {
if ((rev_tmp - rev) > 10)
rev = rev_tmp;
}
}
I also found this library:
https://github.com/merose/AnalogScanner
Maybe this is suitable for me?
Thanks