i am using arduino uno and i have used all 13 pins so i dont have an option to connect switches or keypad,
so i decided that i would use four piezo resitive elements connected to pins A0-A3 as keypad, as i require only four keys.
okay so i have four piezo elements A B C D
there are 10 arrays of led sequence i execute. say A to B i have arrayab and B to C i have arraybc and so on.
so what i want to know is if i can use switch - case statements using analogRead function.
what i tired is i have used
switch (analogRead (A0))
{ case (analogRead (A1) ):
ledsequenceab();
break;
case (analogRead (A2))
ledsequenceac();
break;
default: nosequence;
}
so the error is that i cannot use int type data in case() which takes constant values;
so is there any alternate way to take inputs from piezo elements in form of keypad?
PLease describe the project in more detail, your goal and how you are trying to reach that goal.
Also post your code so far,
The hardware used including links to datasheets and schematics,