//#include <SoftwareSerial.h>
//SoftwareSerial EEBlue(0, 1); // RX | TX
//מגדיר את הpins של כל שתייה.
int Vodka = 2;
int CranberryJuice = 3;
int LemonJuice = 4;
int Gin = 5;
int motorPin = 6;
int state = 0;
int Mix;
//כמה זמן יש עד שהוא מחליף לpump הבא.
int TimeBetweenPours = 500;
void setup()
{
Serial.begin (9600);
Serial.println("The bluetooth gates are open. \n Connect to HC - 05 from any")
//other bluetooth device with 1234 as pairing key!");
//לעשות את הpins 5-2 לoutput כדי להדליק את הboard relay
; pinMode(2, OUTPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
//מוגדר שהrelays יתנו בoutput פחות מתח)מועדף שלא כולם ידלקו באותו הזמן(.
digitalWrite(2, HIGH);
digitalWrite(3, HIGH);
digitalWrite(4, HIGH);
digitalWrite(5, HIGH);
}
//{
//pinMode(motorPin, OUTPUT);
//Serial.begin(9600);
//while (! Serial);
//Serial.println("Speed 0 to 255");
//}
//משתמש כדי לכבות ולהדליק את המנוע, נקרא motorpin .מתי שהקוד נפעל הוא גורם לך
//לתת מספר כדי לשלוט במהירות של המנוע, חייב לתת מספר בין 0 לבין 255.
void loop()
{
if (Serial.available() > 0) {
//בודק האם המידע מגיע מport serial
state = Serial.read();
//קורא את המידע של הport serial
Serial.println(state);
{
//משקאות:
//Cranberry Gin
if (state == 'a') {
Serial.println("Cranberry Gin in the making");
Mix(0, 5000, 2000, 2200); // Vodka, Cranberry juice, Lime juice, Gin
{
//Cape Cod
if (state == 'b') {
Serial.println("Cape Cod in the making");
Mix(1500, 3000, 0, 0); // Vodka, Cranberry juice, Lime juice, Gin
}
//Gimlet
If (state == 'c') {
Serial.printIn("Gimlet in the making");
Mix(0, 0, 800, 3800); // Vodka, Cranberry juice, Lime juice, Gin
}
//בדיקות ותחזוקה
//Set-up Vodka
if (state == 'd')
}
Serial.println("Set-up Vodka");
Mix(1100, 0, 0, 0); // Vodka, Cranberry juice, Lime juice, Gin
{
//Set-up Cranberry juice
if (state == 'e')
}
Serial.println("Set-up Cranberry juice");
Mix(0, 1000, 0, 0); // Vodka, Cranberry juice, Lime juice, Gin
{
//Set-up Lime juice
if (state == 'f') {
Serial.println("Set-up Lime juice");
Mix(0, 0, 1100, 0); // Vodka, Cranberry juice, Lime juice, Gin
}
//Set-up Gin
if (state == 'g') {
Serial.println("Set-up Gin");
Mix(0, 0, 0, 1000); // Vodka, Cranberry juice, Lime juice, Gin
}
//Cleaning
if (state == 'h') {
Serial.println("Set-up Gin");
Mix(4000, 4000, 4000, 4000); // Vodka, Cranberry juice, Lime juice, Gin
}
//Set-up all (intial first time after cleaning)
if (state == 'i')
}
Serial.println("Set-up All");
Mix(800, 800, 800, 1000); // Vodka, Cranberry juice, Lime juice, Gin
{
}
void Mix(int DelayTimeVodka, int DelayTimeCranberryJuice, int
DelayTimeLemonJuice, int DelayTimeGin ) {
state = 0;
delay(800);
digitalWrite(Vodka, LOW) ;
delay(DelayTimeVodka);
digitalWrite(Vodka, HIGH) ;
delay(TimeBetweenPours) ;
digitalWrite(CranberryJuice, LOW) ;
delay(DelayTimeCranberryJuice) ;
digitalWrite(CranberryJuice, HIGH) ;
delay(TimeBetweenPours);
digitalWrite(LemonJuice, LOW) ;
delay(DelayTimeLemonJuice) ;
digitalWrite(LemonJuice, HIGH) ;
delay(TimeBetweenPours) ;
digitalWrite(Gin, LOW) ;
delay(DelayTimeGin) ;
digitalWrite(Gin, HIGH) ;
delay(TimeBetweenPours) ;
Serial.println("Drink is done!") ;
state = 0;
}
if (Serial.available())
}
int speed = Serial.parseInt();
if (speed >= 0 && speed <= 255)
}
analogWrite(motorPin, speed);
{
{
{