My analog pins seem to be inop. I know I shorted the board and it shut off. Now when I hook it back up everything seems fine but my lm35 sensors. When they get heated up the board has a high pitched wine and but I'm not getting a correct output two relays come on and that's it. Here is the code I am working from it was working before the accidental shorting. Another change I made is I hardwired it instead of a bread board (pretty sure the new board is OK I test everything no shorts or opens etc.). Do you think I could have fried my analog inputs. PS I also tried changing the pins of the LM35 inputs same thing happens high wine and two relays.
/*
Controller
Arudino Duemilanove port connections:
Digital Inputs
Push button TB2 at port
Push button TEST at port
Analog Input
LM35 temperature sensors;
TempSens1 at port
TempSens2 at port
Outputs
relay1 at port
relay2 at port
relay3 at port
relay4 at port
*/
// Pin Assignments:
const int TempSens1 = 2; // pin to which temperature sensor 1 is attached to
const int TempSens2 = 3; // pin to which temperature sensor 2 is attached to
const int TB2 = 2; // pin to which TB2 button is conencted
const int TEST = 3; // pin to which TEST button is conencted
const int Relay1 = 12; //pin to which relay 1 is conencted
const int Relay2 =11; //pin to which relay 2 is conencted
const int Relay3 = 10; //pin to which relay 3 is conencted
const int Relay4 = 9; //pin to which relay 4 is conencted
//***********************************CHANGE THESE VALUES ONLY!!!!!! ***********************************************************************
const unsigned char temp1=73; //36 degree*10mV*1024/5V
const unsigned char temp2=82; //40 degree*10mV*1024/5V
const unsigned char temp3=90; //44 degree*10mV*1024/5V
const unsigned char temp4=96; //47 degree*10mV*1024/5V
//***********************************CHANGE THESE VALUES ONLY!!!!!! ***********************************************************************
// Variables:
int TempSens1_Reading= 0; // temperature sensor 1 reading
int TempSens2_Reading= 0; // temperature sensor 2 reading
int TB2buttonState; // the current reading from the input pin
int TB2lastButtonState = LOW; // the previous reading from the input pin
long TB2lastDebounceTime = 0; // the last time the output pin was toggled
int TESTbuttonState; // the current reading from the input pin
int TESTlastButtonState = LOW; // the previous reading from the input pin
long TESTlastDebounceTime = 0; // the last time the output pin was toggled
long debounceDelay = 50; // the debounce time; increase if the output flickers
long one_minute_count1=0;
long one_minute_count2=0;
long one_minute_count3=0;
int read_TB2(){
int reading = digitalRead(TB2);
if (reading != TB2lastButtonState) {
TB2lastDebounceTime = millis();
}
if ((millis() - TB2lastDebounceTime) > debounceDelay) {
TB2buttonState = reading;
}
TB2lastButtonState = reading;
return TB2buttonState;
}
int read_TEST(){
int reading = digitalRead(TEST);
if (reading != TESTlastButtonState) {
TESTlastDebounceTime = millis();
}
if ((millis() - TESTlastDebounceTime) > debounceDelay) {
TESTbuttonState = reading;
}
TESTlastButtonState = reading;
return TESTbuttonState;
}
void setup() {
// Assign inputs and outputs
pinMode(TB2 , INPUT); //set TB2 pin an input pin
pinMode(TEST , INPUT); //set TEST pin an input pin
pinMode(Relay1, OUTPUT); //set Relay1 pin an ouput pin
pinMode(Relay2, OUTPUT); //set Relay1 pin an ouput pin
pinMode(Relay3, OUTPUT); //set Relay1 pin an ouput pin
pinMode(Relay4, OUTPUT); //set Relay1 pin an ouput pin
digitalWrite(Relay1, LOW);
digitalWrite(Relay2, LOW);
digitalWrite(Relay3, LOW);
digitalWrite(Relay4, LOW);
}
void loop() {
while (read_TEST()==true){
digitalWrite(Relay1, HIGH);
digitalWrite(Relay2, HIGH);
digitalWrite(Relay3, HIGH);
digitalWrite(Relay4, HIGH);
}
while (read_TEST()==false && read_TB2()==false){
digitalWrite(Relay1, LOW);
digitalWrite(Relay2, LOW);
digitalWrite(Relay3, LOW);
digitalWrite(Relay4, LOW);
}
while (read_TEST()==false && read_TB2()==true){
TempSens1_Reading = analogRead(TempSens1);
TempSens2_Reading = analogRead(TempSens2);
digitalWrite(Relay1, LOW);
digitalWrite(Relay2, LOW);
digitalWrite(Relay3, LOW);
digitalWrite(Relay4, LOW);
if (TempSens1_Reading >=temp1 || TempSens2_Reading >=temp1){
digitalWrite(Relay1, HIGH);
digitalWrite(Relay2, LOW);
digitalWrite(Relay3, LOW);
digitalWrite(Relay4, LOW);
}
if (TempSens1_Reading >=temp2 || TempSens2_Reading >=temp2){
one_minute_count2=0;
digitalWrite(Relay1, HIGH);
digitalWrite(Relay2, HIGH);
digitalWrite(Relay3, LOW);
digitalWrite(Relay4, LOW);
}
if (TempSens1_Reading >=temp3 || TempSens2_Reading >=temp3){
digitalWrite(Relay1, HIGH);
digitalWrite(Relay2, HIGH);
digitalWrite(Relay3, HIGH);
digitalWrite(Relay4, LOW);
one_minute_count1=0;
}
if (TempSens1_Reading >=temp4 || TempSens2_Reading >=temp4){
digitalWrite(Relay1, HIGH);
digitalWrite(Relay2, HIGH);
digitalWrite(Relay3, HIGH);
digitalWrite(Relay4, HIGH);
}
}
}