Hello guys, this is my first post and I want to know something about multitasking and button options.
So here is the code:
int val;
int tempPin = 1;
int aa;
int temp;
float ab;
int pelt = 12;
void setup()
{
Serial.begin(9600);
aa = 30;
ab = 29.99;
pinMode(12, OUTPUT);
}
void loop()
{
val = analogRead(tempPin);
float mv = ( val/1024.0)*5000;
float temp = mv/10;
//float farh = (temp*9)/5 + 32;
Serial.print("TEMPRATURE = ");
Serial.print(temp);
Serial.print("*C");
Serial.println();
//delay(250);
if (temp < aa)
{
digitalWrite(pelt, HIGH);
}
else (temp > ab);
{
digitalWrite(pelt, LOW);
}
}
I want to change and variables to button controlled. Like you press a button that changes the which is temp at which to stop cooling and it is from 15-> -20 (which -20 is don't stop cooling) and to be the temp which to start cooling and it should range from 45->15. The temperature is in celsius and something else is that I want to change is the delay and
digitalWrite(pelt, HIGH or LOW) to don't be timed but like On and Off
Then I would add a display, prefferably this one
And it would display °C and when you press a button to change max and min temp then it will display that for 5 sec and come back to °C displaying. My arduino is Arduino Leonardo and I don't have the LCD display yet. Thanks for helping
PS: The peltier would be switching off and on with a relay, that would be controlled with a bd139 NPN transistor due to low voltage arduino output