Hello guys I am having trouble with my simple code. I am new to arduino and am unfamiliar with the language, the code is as follows.
int lowtemp=5.0;
int hightemp=8.0;
int lm35in = A0;
void setup()
{
Serial.begin(9600);
pinMode(7, OUTPUT);
}
void loop()
{
int analogValue;
float temperature;
analogValue = analogRead(lm35in);
temperature = float(analogValue)/1023;
temperature = temperature*500;
Serial.print("temp:");
Serial.print(temperature);
Serial.print("c");
delay(1000);
{
if (temperature) < lowtemp){
digitalWrite(7, LOW);
}
if (temperature) > hightemp){
digitalWrite(7, HIGH);
}
}
}
what I want to do is have a the temperature monitored by a LM35 temperature sensor; and have a relay cut the power when the system reaches the lower temperature of 5 degrees C, and turn back on when the temperature rises to 8 degrees C.
the error is as follows
Arduino: 1.8.10 (Windows 10), Board: "Arduino/Genuino Uno"
In function 'void loop()':
sketch_mini_cooler:25:20: error: expected primary-expression before '<' token
if (temperature) < lowtemp){
^
sketch_mini_cooler:28:20: error: expected primary-expression before '>' token
if (temperature) > hightemp){
^
exit status 1
expected primary-expression before '<' token
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
thank you in advance