Hi guys I am currently working on this project where if the temperature detected by a temperature sensor is above a certain value, it will sound a piezo.
Im very new to arduino and this is my first project so please help.
this is the code im having problems with:
Serial.begin(9600); //Start the serial connection with the computer
//to view the result open the serial monitor
void loop() // run over and over again
//getting the voltage reading from the temperature sensor
int reading = analogRead(sensorPin);
// converting that reading to voltage, for 3.3v arduino use 3.3
float voltage = reading * 5.0;
voltage /= 1024.0;
// now print out the temperature
float temperatureC = (voltage - 0.5) * 100 ; //converting from 10 mv per degree wit 500 mV offset
//to degrees ((voltage - 500mV) times 100)
Serial.print(temperatureC); Serial.println(" degrees C");
delay(1000); //waiting a second
if (??? > 30)
the variable that i want to put in the ??? is the temperature detected but im unsure what to write. Please help
p.s so its like if temperature > 30 then it will sound the piezo.