yes very similar to what the link you posted is doing....This is my code to run LCD button shield:
#include <LiquidCrystal.h>
#define Booster
// Initialize the library with the numbers of the interface pins
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
//States for the menu.
int currentMenuItem = 0;
int lastState = 0;
void setup() {
//Set the characters and column numbers.
lcd.begin(16, 2);
//Print default title.
clearPrintTitle();
Serial.begin(9600);
}
void loop() {
//Call the main menu.
mainMenu();
}
void mainMenu() {
//State = 0 every loop cycle.
int state = 0;
//Refresh the button pressed.
int x = analogRead (0);
//Set the Row 0, Col 0 position.
lcd.setCursor(0,0);
//Check analog values from LCD Keypad Shield
if (x < 100) {
//Right
} else if (x < 200) {
//Up
state = 1;
} else if (x < 400){
//Down
state = 2;
} else if (x < 600){
//Left
} else if (x < 800){
//Select
state = 3;
}
//If we are out of bounds on th menu then reset it.
if (currentMenuItem < 0 || currentMenuItem > 4) {
currentMenuItem = 0;
}
//If we have changed Index, saves re-draws.
if (state != lastState) {
if (state == 1) {
//If Up
currentMenuItem = currentMenuItem - 1;
displayMenu(currentMenuItem);
} else if (state == 2) {
//If Down
currentMenuItem = currentMenuItem + 1;
displayMenu(currentMenuItem);
} else if (state == 3) {
//If Selected
selectMenu(currentMenuItem);
}
//Save the last State to compare.
lastState = state;
}
//Small delay
delay(5);
}
//Display Menu Option based on Index.
void displayMenu(int x) {
switch (x) {
case 1:
clearPrintTitle();
lcd.print ("->Booster Effect");
break;
case 2:
clearPrintTitle();
lcd.print ("->Clean Effect");
break;
case 3:
clearPrintTitle();
lcd.print ("->Metronome");
break;
case 4:
clearPrintTitle();
lcd.print ("->Tremolo Effect");
break;
}
}
//Print a basic header on Row 1.
void clearPrintTitle() {
lcd.clear();
lcd.setCursor(0,0);
lcd.print("MegaEffect Pedal ");
lcd.setCursor(0,1);
}
//Show the selection on Screen.
void selectMenu(int x) {
switch (x) {
case 1:
clearPrintTitle();
lcd.print ("U Chose Booster");
//Call the function that belongs to Option 1
void Booster(); // Issues with this line here<
Serial.println("Running Booster");
break;
case 2:
clearPrintTitle();
lcd.print ("U Chose Clean");
//Call the function that belongs to Option 2
Serial.println("Running Clean");
break;
case 3:
clearPrintTitle();
lcd.print ("U Chose Metronome");
//Call the function that belongs to Option 3
Serial.println("Running Metronome");
break;
case 4:
clearPrintTitle();
lcd.print ("U Chose Tremolo");
//Call the function that belongs to Option 4
Serial.println("Running Tremolo");
break;
}
}
Then on tabs in same sketch I have the four effects. i'm using the AudioDsp.ino files for the effects. The above code works....But i dont know how to call in the AudioDsp.ino effect files....Cant seem to figure it out....I know that i need to make changes to variables and there is currently some Pin conflicts that need addressing...This is the code i have for Booster:
/*
pedalShieldUno/AudioDSP/booster
Alternate implementation of the pedalshield_uno_booster effect.
- reads the ADC and plays it into the PWM output.
- pressing the pushbutton_1 or 2 turns the volume up or down.
For info and circuit diagrams see
github.com/tardate/LittleArduinoProjects...Uno/AudioDSP/booster
*/
#include <AudioDspDriver.h> // main AudioDSP controller class
AudioDspDriver dsp_driver;
void setup1() {
dsp_driver.init();
}
void loop1() {
dsp_driver.process_controls();
}
/* transformer
* the input signal is 16 bit signed (values from -32768 to +32767, INT16_MIN to INT16_MAX)
* pb_level is 0-1024 with midpoint 512
*/
int16_t transformer(int16_t input, int pb_level) {
int16_t volume = map(pb_level, 0, 1024, 0, INT16_MAX);
return map(input, INT16_MIN, INT16_MAX, -volume, volume);
}
/* Timer 1 interrupt service routine
* Perform audio input/processing/output here
*/
ISR(TIMER1_CAPT_vect) {
dsp_driver.transform(&transformer);
}
Granted there are two library files for the AudioDsp I haven't included here..if you need them follow link at to of booster file. I appreciate your help. I know I need to change some pin call outs to eliminated conflicts and want to try to keep the changes to the Effect files and not change the LCD button shield just yet as it currently sits on top of uno..I need to figure out how to tie the Lcd shield into the pedalshield....Still waiting on my parts order to show up that got lost in delivery and company sent out another order...then i can build my pedal shield on bread board to get it running...