The buttons are embedded with an image and text of the drink described. To achieve this we created a Tkinter button and assigned it a variable. We used Tkinter’s PhotoImage Class Function to import the .gif picture as a variable as well. Once the image is assigned as a variable we can configure the button to have the variable be the button’s image. A text label of the drink name is then packed under the image inside of the button. The ingredients list text is then placed under the button.
When the button is pressed is calls the appropriate function to start the progress bar and open the serial port to the Arduino. Before sending the drink information to the Arduino, we set the serial port DTR to level 0 or False. This is to ensure proper serial communication with the Arduino via USB cable. Setting the DTR to 0 or False prevents the Arduino from resetting its communication on the USB port. Without setting the DTR we had intermittent connections.
The Raspberry Pi sends the Arduino the Recipe/Instructions to make the drink selected. It does this by sending our custom protocol. Which are just 9 values separated by commas. The Arduino parses out the values and assigns them variables.