1
//#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);
    {
      {
        {
4
  • 1
    The compiler is seeing int Mix; first and presumably the IDE is not generating a function prototype (that would conflict anyway) for the Mix function. Beyond that, the error message says it all, int Mix; is not a function, so you can't call it Mix(0, 5000, 2000, 2200);. The IDE has an Auto-Format option under Tools. – timemage May 23 at 10:53
  • 2
    Your code is a mess. You have brackets where brackets shouldn't be. Closing brackets with no opening bracket, opening brackets with no closing brackets, brackets without anything that needs a bracket, etc. Just a mess. Sort it out. – Majenko May 23 at 10:55
  • 1
    You have a variable int Mix as wel as a function called void Mix(). The void Mix() function is declared within another function ( loop () ), which is not allowed. When refering to the Mix() function, the compiler does not know what to do with it. Furthermore, your code is very confusing. Please learn about scope, when to use open and closing brackets etcetera. – StarCat May 23 at 10:59
  • I've tried to clean up your code without a great deal of success. You need to do some C++ tutorials and get the hang of the language. Your use of braces (like { ... } ) is very confusing. Do some simple and easy tutorials, and learn about how braces work in the language, and how "if" works. You have "if" statements there with nothing obvious following them to be done conditionally. – Nick Gammon May 26 at 6:48

Browse other questions tagged or ask your own question.