I am trying to make a ice machine control I have every thing wired up and running fine but after about 4hrs it disides to lock up and stop running and I have no idea way this happens can anyone help my out
this is my sketch
//-------------------------------SET PINS---------------------------
int plateS1 = 4;
int f1 = 2;
int f2 = 3;
int f1s = 1;
int f2s = 1;
int PS = 0;
const int watergate = 9;
const int comp = 10;
const int waterP = 11;
const int reverse = 12;
//------------------------------ lcd setup-------------------------
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x3F // Define I2C Address where the PCF8574A is
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
int n = 1;
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
//-------------------------------
void setup() {
//--------------------------------SET SERIAL AND LCD START UP---------------
Serial.begin(9600);
lcd.begin (16,2);
//--------------------------------SET INPUTS------------------------
pinMode(f1, INPUT);
pinMode(f2, INPUT);
pinMode(plateS1, INPUT);
//--------------------------------SET OUTPUTS------------------------
pinMode(watergate, OUTPUT);
pinMode(comp, OUTPUT);
pinMode(waterP, OUTPUT);
pinMode(reverse, OUTPUT);
//--------------------------------TURN RELAYS OFF--------------------
digitalWrite(comp, HIGH);
digitalWrite(waterP, HIGH);
digitalWrite(watergate, HIGH);
digitalWrite(reverse, HIGH);
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.setCursor ( 4 , 0 );
lcd.print("Welcome");
delay(5000);
}
void loop() {
Start_Up://-----------------------------------Start_Up------------------------------
// in start up we check to see if the hopper is full
// If hopper is full Machine will hold at this piont untill hopper has been cleared
// If hopper is empty the Machine will begin to make ice
PS = digitalRead(plateS1);
delay(1000);
if (PS == LOW)
{
Serial.print("Hopper Full");
delay(500);
lcd.clear ();
delay(500);
lcd.setCursor ( 0 , 0 );
lcd.print("Hopper Full");
lcd.setCursor ( 0 , 1 );
lcd.print("Please Empty");
delay(5000);
goto Start_Up;
}
else
{
Serial.print("Hopper Empty");
delay(500);
lcd.clear ();
delay(500);
lcd.setCursor ( 0 , 0 );
lcd.print("Ready");
goto Start;
}
//----------------------------------START--------------------
Start:
//-----------------------------------------------------------
digitalWrite(comp, HIGH); //
digitalWrite(waterP, HIGH); // turns all relays off
digitalWrite(watergate, HIGH); //
digitalWrite(reverse, HIGH); //
//-----------------------------------------------------------------
//------------------------Check_What_Hight_Water_Is----------------
f1s = digitalRead(f1);
if (f1s == HIGH)
{
Serial.print(" Water is full ");
goto clean;
}
else
{
Serial.print(" Water is low ");
delay(2000);
goto Fill_Water;
}
clean: //-----------------------------Clean Plate------------
Serial.print("Cleaning plate");
lcd.clear ();
delay(500);
lcd.setCursor ( 0 , 0 );
lcd.print("Cleaning Plate");
digitalWrite(watergate, HIGH);
digitalWrite(comp, HIGH);
digitalWrite(waterP, LOW);
delay(60000);
Serial.print("Plate has been cleaned");
lcd.clear ();
delay(500);
lcd.setCursor ( 0 , 0 );
lcd.print("Plate Cleaned");
goto Makeice;
//-----------------------------------------------------------
//-----------------------------------FILL_Water--------------
Fill_Water:
//-----------------------------------------------------------
digitalWrite(waterP, HIGH);
digitalWrite(watergate, LOW);
Serial.print("filling water");
lcd.clear ();
delay(500);
lcd.setCursor ( 0 , 0 );
lcd.print("Filling Water");
f1s = digitalRead(f1);
delay(1000);
if (f1s == HIGH)
{
Serial.print(" WATER HI ");
delay(2000);
lcd.setCursor ( 0 , 0 );
lcd.clear ();
lcd.print("High Water");
Serial.print(" Clean Plates ");
goto clean;
}
else
{
Serial.print(" WATER LOW ");
delay(2000);
goto Fill_Water;
}
goto Start;
Makeice: //-------------------------------MAKE ICE --------------
digitalWrite(watergate, HIGH);
digitalWrite(comp, LOW);
delay(2000);
lcd.clear ();
lcd.setCursor ( 0 , 0 );
lcd.print("Compressor ON");
Serial.print(" COMP ON ");
digitalWrite(waterP, LOW);
lcd.setCursor ( 0 , 1 );
lcd.print("Water Pump ON");
delay(2000);
Serial.print(" Water Pump ON ");
delay(1000);
Serial.print(" MAKING ICE ");
lcd.clear ();
lcd.setCursor ( 0 , 0 );
lcd.print("Making Ice");
delay(6000);
goto F2s;
F2s: //----------------------------------F2s--------------------
f2s = digitalRead(f2);
if (f2s == HIGH)
{
goto F2s;
}
else
{
goto DROPICE;
}
DROPICE: //-----------------------------DROP ICE-------------
Serial.print(" Lets heat it up ");
delay(2000);
digitalWrite(waterP, HIGH);
delay(2000);
Serial.print(" waterP off ");
delay(2000);
digitalWrite(reverse, LOW);
delay(2000);
Serial.print(" Hot Gas ON ");
goto plate_S;
plate_S: //-------------------------------Check For Ice Drop----
PS = digitalRead(plateS1);
if (PS == HIGH)
{
goto plate_S;
}
else
{
Serial.print(" Cheching for ice drop ");
delay(1000);
Serial.print(" 1 plate droped ");
delay(180000);
lcd.clear ();
lcd.setCursor ( 0 , 0 );
lcd.print("ICE Dropped");
Serial.print("we have done it");
delay(2000);
digitalWrite(reverse, HIGH);
digitalWrite(comp, HIGH);
goto Start;
}
}