So the v3.ino worked, except I had to change :
if(Serial.available() > 0)
{ //Checks for App data (serial port)
state = Serial.parseInt(); //Reads data
Serial.println(state);
}
Back to:
if(Serial.available() > 0)
{ //Checks for App data (serial port)
state = Serial.read(); //Reads data
Serial.println(state);
}
Because the "println" code wouldn't turn on any relays for the pumps. So with the ver 3, and the Send1ByteNumber as per Evans Post...every thing seems to be working correctly.
I'll be honest....I'm lost on what command it is actually sending to the arduino now....so I'm kinda confused how it is working. I'm assuming if I want to add more drinks or create setup buttons for each alcohol I just keep the correct order on the arduino code, and the app?
OK -
- The cocktail names are stored in a Blocks List. The cocktail ingredients are also stored in a Blocks List, in sequence with the cocktail names. Each Item of a List has an index number, starting at 1 (Item 1) and currently ending at 21 (Item 21).
cocktail Index 1: AMF; Ingredients Index 1: Sour mix, gin, vodka, tequila, rum
cocktail Index 2: BGM; Ingredients Index 2: Creme de violette, gin, lemon juice
-
The procedure 'PopulateListView' combines the two Block Lists into one List View component that displays the info to the App User. The List View also has Index numbers (currently 1 to 21), same as the Block Lists.
-
When the App User selects a cocktail from the List View, the code 'knows' the Index number of the selection. For example, if the User selects "Double Strike", that's index number 8 - the code sends that number, the 'Selection Index', to the Arduino. The code also uses the Main Text of the List View selection (Main Text = Cocktail Name) to inform the User that the system is making the cocktail (Status) .
-
When the Arduino receives the selection index number as the variable 'state', the switch code runs the Mix procedure, sending it the ingredients required to make the cocktail. If the cocktail was made by hand the ingredient values would be in one of any traditional liquid measurements. In the USA that might be fluid ounces - so a "Double Strike" cocktail would be 1 1/2 oz Vodka, 1 oz Blue Curacao, 3/4 oz Cranberry Juice, 3/8 oz Lime Juice. These measures are approximated as the time in milliseconds required for the pump to pour it's ingredient.
So if you want to add another cocktail, you just update the Block Lists in the App and Add another 'case' in the Arduino Sketch. I would keep the cocktails in alphabetical order to make life easier for the User.
You can add a new item to a Block List in any position. Just make sure it's added in the same position in the Arduino Sketch.
Cocktails4.aia (4.3 KB)
Cocktail_16_pump_v4.ino (9.6 KB)
To give you a head start, I completed the cocktail ingredients list. I noticed that you don't have a pump for some of the ingredients such as Vanilla Syrup, Lime Juice, Creme de Violette, Soda Water ... etc
Yeah, I'm adding another 8 relays and pumps...lol started off as 8, then I was like if you added this these 2 cocktail ingredients, it allows you to do 4 more cocktails, and ballooned from there. I like to hold cookouts in the summer so, this is going to be my new thing for next summer. I also started from a regular arduino uno, and ended up going to arduino mega.
...may be you need to add an extension to your house