Cocktail Machine Menu Selection with ARDUINO

Hi Everyone, I am New to the Space and would appreciate your help.
I am trying to build an Menu app to bluetooth control the arduino hence control my pump to dispense the cocktail ingredient LED simulated Cocktail machine

I would appreciate if someone can help with the Logic. So far I have built this
MarysCocktail.aia (454.2 KB)
but don't know if i got the logic right but its not working properly.

Any help will be much appreciated . Thank you.

I am not a C expert, but some things in your code bother me.

In line 19 of your sketch

int state = 0;

which declares state as an integer.

Yet later in your code I see tests like

 // 1.	Cosmopolitan (vodka, Cointreau, Cranberry, Lime)
  if (state == "cos" || state == 48)

How do you fit "cos" into an int data type?

1 Like

Looking at your blocks, I see separate buttons with the same pattern for different drink requests:

I see two problems here, duplicated across all those rubber stamped buttons:

  • You assign two messages into the label lblStatus in quick succession, the second immediately wiping out the first. Saying Done here is rather presumptuous of the button, since the drink has not yet gone all through the mixing process nor been presented to the customer. Come to think of it, I once ate at a restaurant that had a waiter who did that at the end of his shift, taking the order then leaving for the day.
  • You are sending text. Look at your sketch, and tell me where it undergoes text to int conversion.

This is a good place to put in a good word for procedures, that let you cut your losses when you make a mistake, concentrating it into a single place rather than plastered all over your app.

I expect sooner or later you will want to have your app listen to the drink mixer, to justify those "Done" announcements? If so, you will need a Clock Timer and a walk through the AI2 Tutorials section for

I appreciate your feedback, I am new to this world of programming and would appreciate a clear direction to solution.

1 Like

Does anyone know how I can get the "when BluetoothClient1.DataReceived" from the bluetooth client palette. Can't seem to find it in my blocks?

There isn't one for plain old BlueTooth.
You have to poll with a Clock.

Since you are already using println() to send your status, this should work:

Here is a simple BlueTooth text receiver sample, for single value per line:
initialize global message to


1 Like

Apologies for the question but What do you mean poll with a clock?