I'm trying to get this sketch to test a variable and if it's changed go back or "go to" a previous line and repeat a process.
First time posting little programming experience so bear with me...
Here is the seemingly relevant part:
if (Pot0 != H2OtPast) {
bailout1; //this part the compiler is saying "not declared in this scope" (what does that mean)
lcd.clear();
lcd.setCursor (0,0);
lcd.print("Watering Time");
lcd.setCursor (0,1);
lcd.print(H2Ot);
lcd.print(" minutes");
H2OtPast == Pot0;
if (Pot0 != H2OtPast){ goto bailout1;}
Here is the sketch in full:
#include <Wire.h>
#include <LCD.h>
#include <LiquidCrystal_I2C.h>
#define I2C_ADDR 0x27
#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
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);
int H2OtPast;
int ThreshPast;
void setup()
{
lcd.begin (16,2);
// Switch on the backlight
lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
lcd.setBacklight(HIGH);
lcd.home (); // go home
}
void loop()
{
int Pot0 = analogRead(A0);
int Pot1 = analogRead(A1);
float H2Ot = Pot0 * (10.0 / 1023.0);
float Thresh = Pot1 *(100 / 1023.0);
if (Pot0 != H2OtPast) {
bailout1;
lcd.clear();
lcd.setCursor (0,0);
lcd.print("Watering Time");
lcd.setCursor (0,1);
lcd.print(H2Ot);
lcd.print(" minutes");
H2OtPast == Pot0;
if (Pot0 != H2OtPast){ goto bailout1;}
}
if (Pot1 != ThreshPast) {
bailout2;
lcd.clear();
lcd.setCursor (0,0); // go to start of 1st line
lcd.print("ThreshHold");
lcd.setCursor (0,1); // go to start of 2nd line
lcd.print(Thresh);
lcd.print(" %");
ThreshPast == Pot1;
if (Pot1 != ThreshPast){ goto bailout2;}
}
lcd.clear();
lcd.setCursor (0,0); // go to start of 1st line
lcd.print("Watering Time");
lcd.setCursor (0,1); // go to start of 2nd line
lcd.print(H2Ot);
lcd.print(" minutes");
delay(2000);
lcd.clear();
lcd.setCursor (0,0); // go to start of 1st line
lcd.print("ThreshHold");
lcd.setCursor (0,1); // go to start of 2nd line
lcd.print(Thresh);
lcd.print(" %");
delay(2000);
}
Thanks!