First of all, thanks for the help and ... Happy new year !
In my humble opinion the 5 option button (analog) option will be great, because it would allow all the users of the lcd shield (which is very common) to benefit of the Menwiz. The 5 buttons menu control is widely used (I have it on my Nikon camera, on the onkyo AVR ampli ecc.) you move "up" and "down" on the menus/options you enter in the sub menus with the "right" button or with "ok" (select) you choose the option by pressing "ok" (select) and the left button is for "exit" (go back).
the 3 button menus the visual back solution.
Now for my particular case .... It Works !! (well quite works ... - )
two of the button are working and two are nor, in any case the menu is working so I just have to trick around the values of the buttons
/*
Analog values representing the pushbutton value are depending on the resitor value used.
Test the values first with the serial.monitor
*/
buttonValue = analogRead(buttonPin); //analog value to simulate the pushed buttons
if(buttonValue >= 700)
{
buttonPressed = 0;
noButtonPressed(); // is calling an extra fucntion
}
else if(buttonValue >= 470 & buttonValue <= 600)
{
buttonPressed = 4;
buttonAct = 1; // set the menu flag1
}
else if(buttonValue >= 300 & buttonValue <=420)
{
buttonPressed = 3;
buttonAct = 1; // set the menu flag1
}
else if(buttonValue >= 100 & buttonValue <=200)
{
buttonPressed = 1;
buttonAct = 1; // set the menu flag1
}
else if(buttonValue >= 10 & buttonValue <=50)
{
buttonPressed = 2;
buttonAct = 1; // set the menu flag1
}
}
Up is working corectly and down is working but it's the left button which should be "esc".
switch (buttonPressed)
{
case 1: // Up
return MW_BTU;
break;
case 2: // Confirm
return MW_BTC;
break;
case 3: // Down
return MW_BTD;
break;
case 4: // Escape
return MW_BTE;
break;
}
}
the working test line is:
int adc_key_val[5] ={30, 150, 360, 535, 760 };
so in some ways I'll find the solution.
.... Grazie Brunialti, for the particular attention to my stupid problems, I apreciate that and I will do my best to understand and follow your advices.
As soon I get the solution to the buttons problem I'll post it. I think can help those are starting like me.
ciao