Hello All,
It's my first post on these forums and after a while of searching I can't seem to find exactly what I am looking for. I am new to Arduino, but have pretty decent knowledge of micro controllers, wireless, and electronics in general.
I am working on a project to design a stand alone, temperature controlled, A/C SS Relay for the purposes of controlling an old space heater/electric water heater from my solar power rig (for a cabin). I have the circuit designed and the wiring logistics are not a problem. I am using a one wire Temperature Probe and an LCD shield with the 6 push buttons for the sake of having a stand alone unit that can output to power the relay (activating a transistor to pull power down to the relay and switch it on/off using digital out on A0), the relay is then connected to a standard NEMA outlet to provide an outlet of AC power that turns on/off as required, since the devices plugging in do not have the correct logic built in to take a direct digital input.
My question is: when I am coding for my buttons, do I need to factor in a debounce feature that can accomodate all 6 buttons simltaneously? or should I pass something to the debounce, one button at a time?
My variables and initialization look like this:
//----------------- Import Libraries ---------------------
//one wire and Dallas temp are not standard and must be added to the arduino compiler software
#include <OneWire.h>
#include <LiquidCrystal.h>
#include <DallasTemperature.h>
//----------------- DEFINE CONSTANTS ---------------------
// DS18S20 Temperature chip i/o
OneWire probe(8); // set up to read temperature on pin 8 and assign variable name probe
DallasTemperature sensors(&probe); // Tell dallas library to read one wire probe
int led = 13; // Pin 13 has an LED connected on most Arduino boards.
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); //initialize the LCD with standard Pin diagram
//Initialize Buttons all will change once my shield shows up and I identify the buttons properly
int tempup = 10; //this will CHANGE when the sheild shows up and button mappings can be identified (increase set temp for relay)
int tempdown = 9; //this will CHANGE when the sheild shows up and button mappings can be identified (decrease set temp for relay)
int cf = 7;
int start = 8;
int off = 1;
int hc = 6;
int relay = A0; //this will CHANGE when the sheild shows up and button mappings can be identified (Relay trigger)
//----------------- Declare Variables --------------------
int SetTemp = 24; //start temperature setting at 24 degrees celcius
float CurrentTemp = 0; //temperature initialization for the temperature sensor
int farenheitTemp = 0; //variable initialization for later converting temp sensor data to farenheit
//initialize all inputs for variables associated to buttons
boolean power = LOW; // start/STOP(off) pin variable
boolean hotCold = LOW; //Initialize Heating or cooling mode for HC button, low for heat and high for cooling default
boolean tempType = LOW; // celcius/farenheit temp selector
boolean increaseTemp = LOW; //boolean value to track weather temp should go up next loop or not
boolean decreaseTemp = LOW; //boolean value to track weather temp should go down next loop or not
//temp values to track button presses throughout code will be reset to low after each loop
boolean temp1 = increaseTemp;
boolean temp2 = decreaseTemp;
boolean temp3 = tempType;
boolean temp4 = power;
boolean temp5 = hotCold;
Do I even need the temp variables to track buttons along the way? or is it easier to do this another way? Turns out that I tried to do something larger than most people for my first project.
I appreciate any help and feedback. Let me know if anything I've posted is unclear.
Astralus