Thomas sxt
Published

Cocktail Machine: Smartphone Controlled

You like technology and party? This project is made for you! We will create an cocktail machine controlled by smartphone.

BeginnerFull instructions provided15 hours835
Cocktail Machine: Smartphone Controlled

Things used in this project

Story

Read more

Code

Code snippet #1

Plain text
<p>char junk;<br>String inputString="";</p><p>void setup()                    // run once, when the sketch starts
{
 Serial.begin(9600);            // set the baud rate to 9600, same should be of your Serial Monitor
 
 pinMode(2, OUTPUT);
 digitalWrite(2,HIGH);
 
  pinMode(3, OUTPUT);
   digitalWrite(3,HIGH);
   
   pinMode(4, OUTPUT);
   digitalWrite(4,HIGH);
 
   pinMode(5, OUTPUT);
   digitalWrite(5,HIGH); 
   
   pinMode(6, OUTPUT);
   digitalWrite(6,HIGH);
   
   pinMode(7, OUTPUT);
   digitalWrite(7,HIGH); 
   
   pinMode(8, OUTPUT);
   digitalWrite(8,HIGH); 
   
   pinMode(9, OUTPUT);
   digitalWrite(9,HIGH); 
   
   
}void loop()
{
 
  if(Serial.available()){
  while(Serial.available())
    {
      char inChar = (char)Serial.read(); //read the input
      inputString += inChar;        //make a string of the characters coming on serial
    }
    Serial.println(inputString);
    while (Serial.available() > 0)  
    { junk = Serial.read() ; }      // clear the serial buffer
    if(inputString == "1"){         //whysky coca
            digitalWrite(5, LOW);    //whyski
      delay(1500);                  //temps distrib whisky
      digitalWrite(5, HIGH);
      delay(1500);                   //
      digitalWrite(4, LOW);           //coca
      delay(3000);                    //temps distrib coca
      digitalWrite(4, HIGH);           //
       delay(1500);
    }else if(inputString == "2"){   //wodka orange
      digitalWrite(9, LOW);          //wodka
      delay(1500);
      digitalWrite(9, HIGH);
      delay(1500);                        //
      digitalWrite(2, LOW);                //orange
      delay(3000);
      digitalWrite(2, HIGH);          //
     delay(1500);
      }else if(inputString == "3"){   //ricard eau
      digitalWrite(8, LOW);          //ricard
      delay(1500);
      digitalWrite(8, HIGH);
      delay(1500);                        //
      digitalWrite(3, LOW);                //eau
      delay(3000);
      digitalWrite(3, HIGH);          //
    delay(1500);
      }else if(inputString == "4"){   //COCA
      digitalWrite(4, LOW);          //COCA
      delay(1500);
      digitalWrite(4, HIGH);
      delay(1500);                        //
 
      }else if(inputString == "5"){   //whisky gay
      digitalWrite(5, LOW);          //whysky
      delay(1500);
      digitalWrite(5, HIGH);
      delay(1500);                        //
      digitalWrite(2, LOW);                //orange
      delay(3000);
      digitalWrite(2, HIGH);          //
    delay(1500);
      }else if(inputString == "6"){   //tequila orange
      digitalWrite(7, LOW);          //tequila
      delay(1500);
      digitalWrite(7, HIGH);
      delay(1500);                        //
      digitalWrite(2, LOW);                //orange
      delay(3000);
      digitalWrite(2, HIGH);          //
    delay(1500);
      }else if(inputString == "7"){   //gin orange
      digitalWrite(6, LOW);          //gin
      delay(1500);
      digitalWrite(6, HIGH);
      delay(1500);                        //
      digitalWrite(2, LOW);                //orange
      delay(3000);
      digitalWrite(2, HIGH);          //
      delay(1500);
//shooter
      }else if(inputString == "8"){   //whisky
      digitalWrite(5, LOW);          //whisky
      delay(1500);
      digitalWrite(5, HIGH);
     delay(1500);</p><p>      }else if(inputString == "9"){   //wodka 
      digitalWrite(9, LOW);          //wodka
      delay(1500);
      digitalWrite(9, HIGH);
     delay(1500);</p><p>      }else if(inputString == "0"){   //tequila
      digitalWrite(7, LOW);          //tequila
      delay(1500);
      digitalWrite(7, HIGH);
     delay(1500);</p><p>      }else if(inputString == "a"){   //gin
      digitalWrite(6, LOW);          //gin
      delay(1500);
      digitalWrite(6, HIGH);
      delay(1500);</p><p>      }else if(inputString == "b"){   //tgv
      digitalWrite(7, LOW);          //tequila
      delay(500);
      digitalWrite(7, HIGH);
      delay(1500);                        //
      digitalWrite(6, LOW);                //gin
      delay(500);
      digitalWrite(6, HIGH);          //
      delay(1500);
     digitalWrite(9, LOW);                //wodka
      delay(500);
      digitalWrite(9, HIGH);</p><p> //soft
      }else if(inputString == "c"){   //orange
      digitalWrite(2, LOW);          //orange
      delay(3000);
      digitalWrite(2, HIGH);</p><p>      }else if(inputString == "d"){   //eau
      digitalWrite(3, LOW);          //eau
      delay(3000);
      digitalWrite(3, HIGH);
     </p><p>      }else if(inputString == "e"){   //coca
      digitalWrite(4, LOW);          //coca
      delay(3000);
      digitalWrite(4, HIGH);</p><p>    }
    inputString = "";
  }
}</p>

Credits

Thomas sxt

Thomas sxt

4 projects • 19 followers

Comments