Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Friday!Stream Hackster Holidays, Ep. 7 on Friday!
Thomas sxt
Published © GPL3+

Cocktail Machine with GUI Raspberry

In this tutorial we will create an automated cocktail machine with an graphic interface.

IntermediateFull instructions provided10 hours4,053
Cocktail Machine with GUI Raspberry

Things used in this project

Hardware components

Raspberry Pi 2 Model B
Raspberry Pi 2 Model B
×1
water pump
×1
Relay (generic)
8 channel
×1
pipe
×1
Adafruit touchscreen
×1
sd card
×1

Software apps and online services

raspbian modified
putty
win 32 disk imager

Story

Read more

Code

Code snippet #4

Plain text
<p>#!/bin/bash<br> 
while true; do
  choice="$(zenity --width=400 --height=300 --list --column "" --title="Cocktail" \
  "cocktail" \
  "soft" \
   "shooter" \
   "cow boy")"
  
  echo $choice
 
  case "${choice}" in
    "cocktail" )
      while true; do
        choice="$(zenity --width=400 --height=300 --list --column "" --title="test" \
        "whisky coca" \
        "wodka orange" \
		"ricard eau" \
		"tequila orange"\
		"Gin orange")"
 
		echo $choice
		
        case "${choice}" in
          "whisky coca" )
            
  gpio mode 2 out
        sleep 3
        gpio mode 2 input \</p><p>        gpio mode 0 out
       sleep 4
       gpio mode 0 input
         </p><p>			break
          ;;
          "wodka orange" )
             gpio mode 3 out
        sleep 2
        gpio mode 3 input \</p><p>        gpio mode 7 out
       sleep 4
       gpio mode 7 input
         
			break
          ;;
		  "ricard eau" )
             gpio mode 24 out
        sleep 3
        gpio mode 24 input \</p><p>        gpio mode 25 out
       sleep 3
       gpio mode 25 input
         
			break
          ;;
		    
          "tequila orange" )
             gpio mode 22 out
        sleep 3
        gpio mode 22 input \</p><p>        gpio mode 7 out
       sleep 3
       gpio mode 7 input
         
			break
          ;;
		   "Gin orange" )
            gpio mode 23 out
        sleep 2
        gpio mode 23 input \</p><p>        gpio mode 7 out
       sleep 4
       gpio mode 7 input
         
			break
       ;;
		  *)
			echo "bye"
			break
		  ;;
        esac
      done
     ;;
	 "soft" )
		while true; do
        choice="$(zenity --width=400 --height=300 --list --column "" --title="test" \
        "orange" \
		"coca" \
        "eau")"
		
		echo $choice
 
        case "${choice}" in
          "orange" )
             gpio mode 7 out
       sleep 6
       gpio mode 7 input
			break
          ;;
          "coca" )
             gpio mode 0 out
       sleep 6
       gpio mode 0 input
			break
          ;;
		  
		   "eau" )
             gpio mode 25 out
       sleep 6
       gpio mode 25 input
			break
          ;;
		  *)
			echo "bye"
			break
		  ;;
		  esac
		  done
	 ;;
	
    
 "shooter" )
		while true; do
        choice="$(zenity --width=400 --height=300 --list --column "" --title="test" \
        "whisky" \
		"wodka" \
		"tequila" \
		"gin" \
        "TGV")" 
		
		echo $choice
 
        case "${choice}" in
          "whisky" )
             gpio mode 2 out
       sleep 2
       gpio mode 2 input
			break
          ;;
          "wodka" )
             gpio mode 3 out
       sleep 2
       gpio mode 3 input
			break
          ;;
		  "tequila" )
             gpio mode 22 out
       sleep 2
       gpio mode 22 input
			break
          ;;
		  "gin" )
             gpio mode 23 out
       sleep 2
       gpio mode 23 input
			break
          ;;
		  "TGV" )
               gpio mode 22 out
        sleep 1
        gpio mode 22 input \</p><p>        gpio mode 23 out
       sleep 1
       gpio mode 23 input \
	   
	   gpio mode 3 out
        sleep 1
        gpio mode 3 input 
			break
          ;;
		  *)
			echo "bye"
			break
		  ;;
		  esac
		  done
	 ;;</p><p> "cow boy" )
		while true; do
        choice="$(zenity --width=400 --height=300 --list --column "" --title="test" \
        "ricard pierre" \
		"whisky coca" \
		"wodka orange" \
		"gin orange" \
		"tequila orange" \
        "cimetière")"
		
		echo $choice
 
        case "${choice}" in
          "ricard pierre" )
             gpio mode 24 out
        sleep 4
        gpio mode 24 input \</p><p>        gpio mode 25 out
       sleep 5
       gpio mode 25 input
			break
          ;;
          "whisky coca" )
            gpio mode 2 out
        sleep 3
        gpio mode 2 input \</p><p>        gpio mode 0 out
       sleep 6
       gpio mode 0 input
			break
          ;;
		     "wodka orange" )
             gpio mode 3 out
        sleep 3
        gpio mode 3 input \</p><p>        gpio mode 7 out
       sleep 6
       gpio mode 7 input
			break
          ;;
		     "gin orange" )
             gpio mode 23 out
        sleep 3
        gpio mode 23 input \</p><p>        gpio mode 7 out
       sleep 6
       gpio mode 7 input
			break
          ;;
		      "tequila orange" )
             gpio mode 22 out
        sleep 3
        gpio mode 22 input \</p><p>        gpio mode 7 out
       sleep 6
       gpio mode 7 input
			break
          ;;
		        "cimetière" )
             gpio mode 2 out
        sleep 2
        gpio mode 2 input \</p><p>        gpio mode 3 out
       sleep 2
       gpio mode 3 input \
	   
	    gpio mode 23 out
        sleep 2
        gpio mode 23 input \</p><p>        gpio mode 25 out
       sleep 2
       gpio mode 25 input \
	   
	   gpio mode 7 out
       sleep 1
       gpio mode 7 input
			break
          ;;
		  *)
			echo "bye"
			break
		  ;;
		  esac
		  done
	 ;;
	 *)
	  echo "bye"
	  break
    ;;
esac
done</p>

Credits

Thomas sxt
7 projects • 24 followers
🔩Maker Arduino Rasp. 🖨️3DPrint/design creation ! My STL:https://cults3d.com/fr/utilisateurs/diyfunproject 📲WEBSITE:diyfp.fr/thomassxt

Comments