License

Tags
Recommend Projects

The Problem

2 months ago 47
  • Description
  • Documents
  • BOM
  • Attachments
  • Members
  • Comments

Description

 

//INITIALIZATION IN SSETUP FUNCTION

pinMode( Avarie , INPUT_PULLUP);

  pinMode( Ceara , INPUT_PULLUP);

  pinMode( ApaCaldaPin , INPUT_PULLUP);

  pinMode( PolishPin , INPUT_PULLUP);

  //pinMode( osmoza , INPUT_PULLUP);

 

  pinMode( Jet , INPUT_PULLUP);

  pinMode( Jeton , INPUT_PULLUP);

  attachInterrupt(0, CoinReader, LOW );

 

  pinMode( Spuma , INPUT_PULLUP);

 

//#if(_//lcdML_CONTROL_cfg == 4)

//// include

 

 

 

//The function that controlls the relays

void ControlsBut() {

int  osmoza = analogRead(Posmoza) < 350 ? 0 : 1;

  //Serial.print(osmoza);

  unsigned long currentMillis = millis();

  if (currentMillis - previousMillis >= debounce) {

 

    previousMillis = currentMillis;

    if (digitalRead(Avarie))

    {

      ModeAvarie = 1;

    }

    else

    {

      ModeAvarie = 0;

    }

    if (Coins > 0) {

      //////////////////////////JET///////////////////////////

      if (digitalRead(Jet) == 0 && StateJet == 0)

      {

        JetStarted = !JetStarted;

        StateJet = 1;

      }

      else if (digitalRead(Jet) == 1)

      {

        StateJet = 0;

      }

      /////////////////////////CEARA/////////////////////////

      if (digitalRead(Ceara) == 0 && StateCeara == 0 && CearaDone == 0)

      {

        ModeCeara = !ModeCeara;

        JetStarted = !JetStarted;

        StateCeara = 1;

      }

      else if (digitalRead(Ceara) == 1)

      {

        StateCeara = 0;

      }

      /////////////////////////SPUMA////////////////////////

      if (digitalRead(Spuma) == 0 && StateSpuma == 0 && SpumaDone ==0)

      {

        ModeSpuma = !ModeSpuma;

        JetStarted = !JetStarted;

        StateSpuma = 1;

      }

      else if (digitalRead(Spuma) == 1)

      {

        StateSpuma = 0;

      }

 

      /////////////////////////ApaCalda////////////////////////

      if (digitalRead(ApaCaldaPin) == 0 && StateApaCalda == 0 && ApaCaldaDone == 0)

      {

        ModeApaCalda = !ModeApaCalda;

        JetStarted = !JetStarted;

        StateApaCalda = 1;

      }

      else if (digitalRead(ApaCaldaPin) == 1)

      {

        StateApaCalda = 0;

      }

      /////////////////////////PolishLichid////////////////////////

     

      if (digitalRead(PolishPin) == 0 && StatePolish == 0 &&  PolishDone == 0)

      {

        ModePolish = !ModePolish;

        JetStarted = !JetStarted;

        StatePolish = 1;

      }

      else if (digitalRead(PolishPin) == 1)

      {

        StatePolish = 0;

      }

 

      ///////////////////////OSMOZA//////////////////////////

      if (osmoza == 0 && StateOsmoza == 0 )

      {

        JetStarted = !JetStarted;     

        if (SystemStarted == 0)

        {         

          OsmozaRun = 1;

        }

        

        StateOsmoza = 1;

 

      }else if (osmoza  == 1)

    {

      StateOsmoza = 0;

    }

    } 

  }

 

 

 

}

 

void WashingManager() {

  if (JetStarted == 0 && SystemStarted == 0)

  {

    GetReadyMenu();

  } else if (JetStarted == 0) {

    TimeoutManager();

    ////lcd.setCursor(0, 0);

    if (OsmozaRun == 0)

    {

      ////lcd.print(F("Sistem Jet Oprit  "));

    } else

    {

      ////lcd.print(F("Sistem Osmoza Oprit"));

    }

 

 

    JetTimer.pause();

    SpumaTimer.pause();

    CearaTimer.pause();

    ApaCalda.pause();

    PolishLichid.pause();

    ModeSpuma = 0;

    ModeCeara = 0;

    ModeApaCalda = 0;

    ModePolish  = 0;

    digitalWrite(Releu2, 0);

    digitalWrite(Releu3, 0);

    digitalWrite(Releu4, 0);

    digitalWrite(Releu5, 0);

    digitalWrite(Releu6, 0);

    digitalWrite(Releu7, 0);

    digitalWrite(Releu8, 0);    

    display.displayRaw(TM1637_CODES::MINUS, TM1637_CODES::MINUS, TM1637_CODES::MINUS, TM1637_CODES::MINUS);

  } else

  {

 

    JetTimer.run();

    SpumaTimer.run();

    CearaTimer.run();

    ApaCalda.run();

    PolishLichid.run();

    TimeOut = 180;

    if (OsmozaRun == 0)

    {

      ////lcd.print(F("Sistem Jet Pornit"));

    } else

    {

      ////lcd.print(F("Sistem Osmoza Pornit"));

    }

 

    if (newJet == 0) {

      ////lcd.clear();

      JetTimer.setCounter(0, TmJ, TsJ, JetTimer.COUNT_DOWN, Complete);

 

      newJet = 1;

      SystemStarted = 1;

      JetTimer.start();

    }

    if (OsmozaRun == 1 && newOsmoza == 0) {

 

      SpumaTimer.pause();

      CearaTimer.pause();

      ////lcd.clear();

 

      if (JetTimer.getCurrentMinutes() > TmO)

      {

        JetTimer.stop();

        JetTimer.setCounter(0, TmO, TsO, JetTimer.COUNT_DOWN, Complete);

      }

      else

      {

        int mins = JetTimer.getCurrentMinutes();

        int secs = JetTimer.getCurrentSeconds();

        JetTimer.stop();

        JetTimer.setCounter(0, mins, secs, JetTimer.COUNT_DOWN, Complete);

 

      }

      newOsmoza = 1;

    }

    JetTimer.start();

    digitalWrite(Releu1, 0);

    digitalWrite(Releu2, 1);

    if (OsmozaRun == 1) {

      digitalWrite(Releu5, 1);

    }

 

 

    ///////////////MODE SPUMA///////////////////

    if (ModeSpuma == 1 && SpumaDone == 0 && OsmozaRun == 0)

    {

      if (newSpuma == 0)

      {

        if (JetTimer.getCurrentMinutes() < TmS)

        {

          TmS = JetTimer.getCurrentMinutes();

          TsS = JetTimer.getCurrentSeconds();

        }

 

        SpumaTimer.setCounter(0, TmS, TsS, SpumaTimer.COUNT_DOWN, CompleteSpuma);

 

        newSpuma = 1;

      }

      SpumaTimer.start();

      digitalWrite(Releu3, 1);

    } else if (ModeSpuma == 1 && SpumaDone == 1)

    {

      ////lcd.setCursor(0, 2);

      ////lcd.print(F("Timp Spuma terminat"));

    }

 

    ///////////////MODE CEARA///////////////////

    if (ModeCeara == 1 && CearaDone == 0 && OsmozaRun == 0)

    {

      if (newCeara == 0)

      {

        if (JetTimer.getCurrentMinutes() < TmC)

        {

          TmC = JetTimer.getCurrentMinutes();

          TsC = JetTimer.getCurrentSeconds();

        }

        CearaTimer.setCounter(0, TmC, TsC, CearaTimer.COUNT_DOWN, CompleteCeara );

 

        newCeara = 1;

      }

      CearaTimer.start();

      digitalWrite(Releu4, 1);

    } else if (ModeCeara == 1 && CearaDone == 1)

    {

      ////lcd.setCursor(0, 2);

      ////lcd.print(F("Timp Ceara terminat"));

    }

 

 

 

    ///////////////MODE APACALDA//////////////////

    if (ModeApaCalda  == 1 && ApaCaldaDone  == 0 && OsmozaRun == 0)

    {

      if (newApaCalda == 0)

      {

        if (JetTimer.getCurrentMinutes() < TmA)

        {

          TmA = JetTimer.getCurrentMinutes();

          TsA = JetTimer.getCurrentSeconds();

        }

        ApaCalda.setCounter(0, TmA, TsA, ApaCalda.COUNT_DOWN, CompleteApaCalda );

 

        newApaCalda = 1;

      }

      ApaCalda.start();

      digitalWrite(Releu6, 1);

    } else if (ModeApaCalda  == 1 && ApaCaldaDone  == 1)

    {

      ////lcd.setCursor(0, 3);

 

      ////lcd.print(F("Degresant terminat  "));

    }

 

    ///////////////MODE POLISHLICHID//////////////////

    if (ModePolish  == 1 && PolishDone == 0 && OsmozaRun == 0)

    {

      if (newPolish  == 0)

      {

        if (JetTimer.getCurrentMinutes() < TmP)

        {

          TmP = JetTimer.getCurrentMinutes();

          TsS = JetTimer.getCurrentSeconds();

        }

        PolishLichid.setCounter(0, TmP, TsP, PolishLichid.COUNT_DOWN, CompletePolish );

 

        newPolish  = 1;

      }

      PolishLichid.start();

      digitalWrite(Releu7, 1);

    } else if (ModePolish  == 1 && PolishDone == 1)

    {

      ////lcd.setCursor(0, 3);

      ////lcd.print(F("Polish terminat     "));

 

    }

 

 

  }

 

 

 

 

 

  digitalWrite(Avarie1, 0);

}

Documents

Sheet_1

BOM

None

Attachments

None
Success
The owner does not allow comments in this project now

Comments (0)

goToTop
你现在访问的是EasyEDA海外版,使用建立访问速度更快的国内版 https://lceda.cn(需要重新注册)
如果需要转移工程请在个人中心 - 工程 - 工程高级设置 - 下载工程,下载后在https://lceda.cn/editor 打开保存即可。
有问题联系QQ 3001956291 不再提醒
svg-battery svg-battery-wifi svg-books svg-more svg-paste svg-pencil svg-plant svg-ruler svg-share svg-user svg-logo-cn svg-double-arrow
We use cookies to offer you a better experience. Detailed information on the use of cookies on this website is provided in our Privacy Policy. By using this site, you consent to the use of our cookies.