conflicting assignments

We are trying run this code with a float sensor, and I believe that its conflicting with the "water change functions"

water change part of the code:

void loop()
{ 
  
  
  
  
 if ((waterchangeState) && (millis()>=off_time1)) /* is it on and is it later or equal to off_time */
    {
    digitalWrite(waterchangePin,LOW);
    waterchangeState = false;
    filterState = true;
     if((drainsolenoidState) && (millis()>=off_timeDrainWater))
	{
	digitalWrite(drainsolenoidPin, LOW);
	digitalWrite(addwaterPin, HIGH);
	addwaterState = true;
	digitalWrite(addwaterPumpPin, HIGH);
	addwaterPumpState = true;
	off_timeAddWater = millis() + 3000;
	}
      filterState = true;
      digitalWrite(filter, HIGH);
    }
    else if ((!waterchangeState) && (filterState)) /* is it off? */
{
    waterchangeButtonState = digitalRead(waterchangebutton);
    if(waterchangeButtonState == HIGH)
    {
        digitalWrite(filter, LOW);
        filterState = false;
        digitalWrite(waterchangePin, HIGH);
        digitalWrite(drainsolenoidPin, HIGH);
        drainsolenoidState = true;
	off_timeDrainWater = millis() + 3000;
        waterchangeState = true;
        off_time1 = millis() + 3000;
        
        
       
    }
    
}
  
if(addwaterPumpState)
{
  digitalWrite(addwaterPumpPin, LOW);
  addwaterPumpState = false;
  digitalWrite(addwaterPin, LOW);
  addwaterState = false;
  filterState = true;
  digitalWrite(filter, HIGH);
}

This part only works the way I want it without the float sensor.
Filter is constantly on
When button is pressed, filter is automatically off, and water change and drain led automatically turn on for a few seconds
After water change and drain led turn off after a few seconds, addwater and addwater pump led automatically turns of for a few seconds.
After those two turn off, filter automatically comes back on.

Now when I add a float sensor code:

  val = digitalRead(BUTTON); // read input value and store it

  
  if (val == HIGH) { 
    digitalWrite(LED, HIGH); // turn LED ON
    digitalWrite(addwaterPin, HIGH);
   digitalWrite(addwaterPumpPin, HIGH);
  } else {
    digitalWrite(LED, LOW);
    digitalWrite(addwaterPin, LOW);
    digitalWrite(addwaterPumpPin, LOW);
  }

This code skips the add water and add pump LED(which we don't want), and automatically turns on Filter.

What we want the code to do, is to have the addwater portion of the waterchange function and the addwaterpump (addwaterpump should turn on when the float sensor is false automatically) function to run until the float sensor is tripped (or changed to true).

We believe its a conflicting variable issue. How do we solve this issue?

I'm not sure what a "conflicting variable issue" is, but maybe it is a problem with scope.
Difficult to tell with on a partial code sample.

Here is the whole code, we thought having only a portion might make it easier to read.

#include <DateTimeStrings.h>
#include <OneWire.h>
#include <LiquidCrystal440.h>
#include <DateTime.h>
#include <DallasTemperature.h>



#define dt_SHORT_DAY_STRINGS
#define dt_SHORT_MONTH_STRINGS

#define ONE_WIRE_BUS 9

OneWire oneWire(ONE_WIRE_BUS);
int heater;
DallasTemperature sensors(&oneWire);

DeviceAddress insideThermometer = { 0x10, 0x37, 0xBC, 0x1E, 0x02, 0x08, 0x00, 0xE9 };

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int LED1 = 10; // heater pin location
int LED2 = 25; // heater LED indicator

const int waterchangebutton = 51;
const int buttonPin1 = 51;     // the number of the pushbutton pin
const int buttonPin2 = 50;
const int buttonPin3 = 49;   
const int buttonPin4 = 48;

const int ledPin1 =  35; // the number of the LED pin
const int ledPin2 = 34;
const int ledPin3 = 33; // the number of the LED pin
const int ledPin4 = 32;
const int waterchangePin =  35; // the number of the Equipment pin
const int drainsolenoidPin = 34;
const int addwaterPin = 33; 
const int addwaterPumpPin = 32;
const int feederPin = 31;


  // initialize fitler pin as output
  const int filter = 31;
 
unsigned long off_time1;
unsigned long off_time2;
unsigned long off_time3;
unsigned long off_time4;
unsigned long off_timeDrainWater;
unsigned long off_timeAddWater;

boolean ledState1 = false;
boolean ledState2 = false;
boolean ledState3 = false;
boolean ledState4 = false;
boolean filterState = true;
boolean waterchangeState=false;
boolean drainsolenoidState=false;
boolean addwaterState=false;
boolean addwaterPumpState = false;

int waterchangeButtonState = 0;         // variable for reading the pushbutton status
int buttonState1 = 0;         // variable for reading the pushbutton status
int buttonState2 = 0;
int buttonState3 = 0;         // variable for reading the pushbutton status
int buttonState4 = 0;


  
void setup()
{ DateTime.sync(DateTime.makeTime(50, 59, 7, 16, 10, 2010));
  lcd.begin(8,2);
  pinMode(LED1, OUTPUT);  // heater pin location
  pinMode(LED2, OUTPUT);  // heater LED indicator
 
  // Start up the library
  sensors.begin();
  // set the resolution to 10 bit (good enough?)
  sensors.setResolution(insideThermometer, 10);
  pinMode(addwaterPin, OUTPUT);
  pinMode(waterchangePin, OUTPUT);  
  pinMode(drainsolenoidPin, OUTPUT); 
  pinMode(addwaterPumpPin, OUTPUT);
  pinMode(feederPin, OUTPUT);
  // initialize the pushbutton pin as an input:
    pinMode(waterchangebutton, INPUT);
  pinMode(buttonPin2, INPUT);
  pinMode(buttonPin3, INPUT);
  pinMode(buttonPin4, INPUT);
 
  digitalWrite(waterchangePin, LOW);
  digitalWrite(drainsolenoidPin, LOW);
  digitalWrite(addwaterPin, LOW);
  digitalWrite(addwaterPumpPin, LOW);
  digitalWrite(feederPin, LOW);

  pinMode(filter, OUTPUT);
  digitalWrite(filter, HIGH);
  
    pinMode(filter, OUTPUT);
  digitalWrite(filter, HIGH);
}



void loop()
{ 
  if(DateTime.available()) {
unsigned long prevtime = DateTime.now();
while( prevtime == DateTime.now() ) // wait for the second to rollover
;

DateTime.available(); //refresh the Date and time properties
digitalClockDisplay( ); // update digital clock
}
  sensors.requestTemperatures();
  printTemperature(insideThermometer);
  
  if (heater ==1){
    digitalWrite(LED1, HIGH); // Heater pin
    digitalWrite(LED2, HIGH); // Heater LED indicator
  } else {
    digitalWrite(LED1, LOW);  
    digitalWrite(LED2, LOW);
  
  }
  
 if ((waterchangeState) && (millis()>=off_time1)) /* is it on and is it later or equal to off_time */
    {
    digitalWrite(waterchangePin,LOW);
    waterchangeState = false;
    //filterState = true;
     if((drainsolenoidState) && (millis()>=off_timeDrainWater))
	{
	digitalWrite(drainsolenoidPin, LOW);
	digitalWrite(addwaterPin, HIGH);
	addwaterState = true;
	digitalWrite(addwaterPumpPin, HIGH);
	addwaterPumpState = true;
	off_timeAddWater = millis() + 3000;
	}
      //filterState = true;
      //digitalWrite(filter, HIGH);
    }
    else if ((!waterchangeState) && (filterState)) /* is it off? */
{
    waterchangeButtonState = digitalRead(waterchangebutton);
    if(waterchangeButtonState == HIGH)
    {
        digitalWrite(filter, LOW);
        filterState = false;
        digitalWrite(waterchangePin, HIGH);
        digitalWrite(drainsolenoidPin, HIGH);
        drainsolenoidState = true;
	off_timeDrainWater = millis() + 3000;
        waterchangeState = true;
        off_time1 = millis() + 3000;
        
        
       
    }
    
}
  
if((addwaterPumpState) && (millis()>=off_timeAddWater))
{
  digitalWrite(addwaterPumpPin, LOW);
  addwaterPumpState = false;
  digitalWrite(addwaterPin, LOW);
  addwaterState = false;
  filterState = true;
  digitalWrite(filter, HIGH);
}

  
if ((ledState2) && (millis()>=off_time2)) /* is it on and is it later or equal to off_time */
{
    digitalWrite(ledPin2,LOW);
    ledState2 = false;
}
else if (!ledState2) /* is it off? */
{
    buttonState2 = digitalRead(buttonPin2);
    if(buttonState2 == HIGH)
    {
        digitalWrite(ledPin2, HIGH);
        ledState2 = true;
        off_time2 = millis() + 5000;
    }
}

if ((ledState3) && (millis()>=off_time3)) /* is it on and is it later or equal to off_time */
{
    digitalWrite(ledPin3,LOW);
    digitalWrite(ledPin4,LOW);
    ledState4 = false;
    ledState3 = false;
}
else if (!ledState3) /* is it off? */
{
    buttonState3 = digitalRead(buttonPin3);
    if(buttonState3 == HIGH)
    {
        digitalWrite(ledPin3, HIGH);
        ledState3 = true;
        digitalWrite(ledPin4, HIGH);
        ledState4 = true;
        off_time3 = millis() + 7000;
    }
}



if(DateTime.Hour==10 && DateTime.Minute==0)
  {ledState2 = true;
    digitalWrite(ledPin2, HIGH);
   
  }
  if(DateTime.Hour==10 && DateTime.Minute ==1)
  {ledState2 = false;
    digitalWrite(ledPin2, LOW);
  }
  
  
 
}

void printDigits(byte digits){
// utility function for digital clock display: prints preceding colon and leading 0
lcd.print(":");
if(digits < 10)
lcd.print('0');
lcd.print(digits,DEC);
}

void digitalClockDisplay(){


lcd.setCursor(7,0);
lcd.print("");




//lcd.print(" ");
if(DateTime.Hour <10)
lcd.setCursor(7,0);

// digital clock display of current time

lcd.print(DateTime.Hour,DEC);
printDigits(DateTime.Minute);
printDigits(DateTime.Second);
}
void printTemperature(DeviceAddress deviceAddress)
{
  float tempC = sensors.getTempC(deviceAddress);
  
  lcd.setCursor(0,0);
  lcd.print("");
  lcd.print(DallasTemperature::toFahrenheit(tempC));  
  lcd.print((char)223);
  
 
    
  if (DallasTemperature::toFahrenheit(tempC) < 75.00)
  heater = 1;
  else
  heater = 0;
}

This is the unmodified code, we want to add the float sensor code in the first post to the above code. Also I will have the waterchange function be dependent on the float sensor as well.

This is the unmodified code

Mostly uncommented, too.

We need to see the modified code to venture an opinion on what is wrong. Before you post it though, you might consider refactoring some more of the code in loop into separate functions. It'll make it easier to read, and, if you give the functions sensible names, it'll give us a bit more of a clue as to what you're trying to do. I might suppose that the code checking for a time of 10:00 is an automated fish feeder, but what the other leds are doing with their buttons and timers is a real mystery.

The LED's are going to be used to manually control relays that will power other items for a set amount of time that we determine. So they should only be running, based on the button being pressed, for a certain amount of time. The code waterchange and the floatsensor are the two that we are having problems with.