Cocktail Menu Problem Arduino 2560 Mega

I’m using LCD 20x4 i2c
and a 4x3 Keypad.
hooked up in an Arduino Mega 2560
that also manipulates 6 motor in a Power relay.

Can I make my oz. as a variable that can be use
in selecting cocktail mixes.

Coz I want to make a different delays in each oz.

like 2500 for 6oz.
4000 for 8oz.
6500 for 12oz.
and 8000 for 15oz.
as a sample.

I have some simple flow diagram on my project,
and a sketch on attachments.
Hope Someone can help

UnfinishedBusiness.ino (9.11 KB)

Where in the code will the delays go? Instead of using delay() look into the Blink Without Delay example sketch, it will be a little more writing for you, but it will be better for the code. Unless of course you don't want to do anything else in the time it is mixing the drinks.

One other thing that might make it easier for you; once the code is in the while loop(s), it will not effect any of the other segments. So if you want, for CocktailMenu and GlassSizeMenu, you can still use keys 1 - 4, instead of 3 - 6 and 7 - 10.

I only reason I did it the way I did, was just to match your keypad layout. Speaking of which, now you only have a 4x3 and not a 4x4, it shouldn't make a difference, but its good to keep track of these things.

Was really planning to follow the layout
but the only available keypad is 4x3 that’s
why I made it like that thanks for the info about
the while loop.

Its kinda confusing the
I’ll try to understand it first.
I was really finding a way that I can get
those oz.
as input that can be recalled once I picked
cocktail drinks

like if I choosed 12oz
then picked margarita.

= it gives this value

if I choose 6 oz.
then picker margarita

= it gives another value

can you make some suggestions please.
while I worked on this blinkwithoutdelay.

Use an array with the delay values in it. Keep track of what size was selected with a simple byte variable and use it to change the array's index.

can u give me a sample
just one or two arrays please.

if I choose 6 oz.
then picker margarita

perhaps a 2D array (a lookup table) will work better.

myArray[drink] = {
{ , , , },// cocktail: 2000, 3000, 4000, 5000
{ , , , },// mojito: 1500, 2000, 3500, 4000
{ , , , },//…
{ , , , }//…

To do this properly, I would suggest you rewrite your code.
See attached.

UnfinishedBusiness.ino (9.81 KB)