It can't be wiring because I took the sketch and loaded it into my UNO board with two jumpers to Ao and A1 and it still did it.
Here is the code if anyone wants to way in. Thanks
#include <Arduino.h>
#include <OneWire.h>
#include <DallasTemperature.h> // temperature sensors.
#define ONE_WIRE_BUS 8
// Data wire is plugged into pin 8 on the Arduino
OneWire oneWire(ONE_WIRE_BUS); // Setup a oneWire instance to communicate with any OneWire devices
DallasTemperature sensors(&oneWire); // Pass our oneWire reference to Dallas Temperature.
DeviceAddress Rims = {
0x28, 0xDC, 0x09, 0x22, 0x04, 0x00, 0x00, 0xBD}; //DS18B20 address Done!!
DeviceAddress Mash = {
0x28, 0xEB, 0x6A, 0x21, 0x04, 0x00, 0x00, 0x02 }; //DS18B20 address Done!!
#include <Button.h>
Button one = Button(10,PULLUP); // button on pin 7
Button two = Button(9,PULLUP); // button on pin 9
const int heaterpin = 6; // output on pin 3 conected to heater
float tempC = 23; // tempC will be asigned actual temp later
int cat = 0; // electrodes to insure water level
int dog = 0; // white and blue contect ot A4 & A5 Red central to +ve
int set = 0; // set will be setpoint to display purposes.
int ledpin = 13; // set led to pin 13
int heat = 0; //
int safecat = A2; // pin number A2 is connected the safety pin in the RIMS tube
int safedog = A3; // pin number A3 is connected the safety pin in the RIMS tube
//int Maxpower = 200; // sets how hot the heating element gets when full on upto 255
#include <PID_v1.h>
double Setpoint, Input, Output; //Define Variables we'll be connecting to
PID hltPID(&Input, &Output, &Setpoint,2,5,1, DIRECT); //Specify the links and initial tuning parameters
#include <LiquidCrystal.h> // include the library code:
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); // numbers of the LCD interface pins Analog as digital
void setup(void){
Serial.begin(9600); // start serial port if need to debug
pinMode(ledpin,OUTPUT); // warning light or buzzer
pinMode(safecat,INPUT_PULLUP); // seting the Analog pins to digital input
pinMode(safedog,INPUT_PULLUP); // gnd------ probe---water or not-- probe------pin
cat = digitalRead(safecat); // asigning cat & dog variables with the value
dog = digitalRead(safedog);
sensors.begin(); // Start up the DS18B20 library
sensors.setResolution(Mash,10);// set the resolution to 10 bit (good enough?)
sensors.setResolution(Rims,10);// set the resolution to 10 bit (good enough?)
lcd.begin(20, 4); // set up the LCD's number of columns and rows:
lcd.print("Rims Temp is :");
lcd.setCursor(0, 1);
lcd.print("Mash Temp is :" );
lcd.setCursor(0, 2);
lcd.print(" Set point :" );
Input = tempC; //PID initialize the variables we're linked to
Setpoint = 68.50; // Setpoint entered here can adjust with buttons
hltPID.SetMode(AUTOMATIC); //turn the PID on
// hltPID.SetOutputLimits(0,Maxpower); // limits how hot the heating element gets when full on.
}
// button press sub-routine for increasing setpoint
void Up(){
lcd.setCursor(14, 2);
lcd.print(Setpoint = Setpoint + 0.5);
}
// button press sub-routine for decreasing setpoint
void Down(){
lcd.setCursor(14, 2);
lcd.print(Setpoint=Setpoint - 0.5);
}
void loop(void){
delay (200);
sensors.requestTemperatures(); //get temperature
float tempC = sensors.getTempC(Rims);//asign the temperature to tempC
float tempM = sensors.getTempC(Mash);//asign the temperature to tempM
lcd.setCursor(14, 0);
lcd.print(tempC); // print tempC to LCD
lcd.setCursor(14, 1);
lcd.print(tempM); // print tempM to LCD
lcd.setCursor(14,2);
lcd.print(set); // print Setpoint temp.
// ________________________________________________________________
// lock up the sketch until RIMS is full of water
cat = digitalRead(safecat); // re sample
dog = digitalRead(safedog);
while(cat == HIGH||dog == HIGH){ // both pins need to be conducting to ground
analogWrite(heaterpin,0); // make sure heater is off
digitalWrite(ledpin,HIGH); // Big red led do not heat
// may use a buzzer
cat = digitalRead(safecat); // re sample
dog = digitalRead(safedog);
delay(1000);
Serial.println("in while"); //debug shows it is in the "while" loop
Serial.print("AO= ");
Serial.println(cat);
Serial.print("A1= ");
Serial.println(dog);
lcd.setCursor(5, 3);
lcd.print(cat); // print 1 or 0 just to reasure me
lcd.setCursor(8, 3);
lcd.print(dog);
heat = digitalRead(ledpin); // prints to lcd state of heater
if (heat=0){ // may refine to show how much on
lcd.setCursor(12,3); // little-- medium-- full
lcd.print("Heat ON");
}
else{
lcd.setCursor(12,3);
lcd.print("Heat OFF");
}
if(one.isPressed()){ // may remove this from loop as not needed.
Up();
Serial.print("button1");
}
else if(two.isPressed()){
Down();
Serial.print("button2");
}
}
// __________________________________________________________________
Serial.println("Out ");
delay(500);
digitalWrite(ledpin,LOW); // RIMS tube is full good to go
lcd.setCursor(12,3);
lcd.print("Heat OFF");
set=Setpoint;
Input = tempC; // Asign TempC to PID input
hltPID.Compute(); // PID do its stuff
analogWrite(heaterpin,Output); // Adjust the output
if(one.isPressed()){
Up();
Serial.print("button1");
}
else if(two.isPressed()){
Down();
Serial.print("button2");
}
} // End