Hi. So recently, I decided to make a smart coaster that measured the temperature of my tea/coffee, and if it was below a certain temperature, it would heat up the coaster bed with a 5v element.
I was writing the code for this and verifying it when I got the error message "void value not ignored as it ought to be" and I've searched it up and can't get an adequate answer.
I'm using the website IDE Arduino create because the standard IDE is completely broken on my computer. Im running Mac OS Sierra 10.12.6 and using an arduino pro micro. Please help.
P.S I'm not great at coding so apologies for the sloppy code.
////////////////////////////////
const int optimalTemp = 50 ;
int tempPin = A2;
int elementPin = 5;
void setup() {
pinMode(elementPin, OUTPUT);
analogReference(INTERNAL);
}
void loop() {
int coasterTemp = getAverageTemp();
if (coasterTemp < optimalTemp){
digitalWrite(elementPin, HIGH);
delay(1000);
}
else{
digitalWrite(elementPin, LOW);
delay(1000);
}
}
void getTemp()
{
float tempC;
int reading;
reading = analogRead(tempPin);
tempC = reading / 9.31;
return tempC;
}
void getAverageTemp()
{
int reading1 = getTemp();
int reading2 = getTemp();
int reading3 = getTemp();
float meanTemp = (reading1 + reading2 + reading3) / 3;
return meanTemp;
}
////////////////////////////////