Well I ran through the project just fine, my LED's light up as the sensor gets warmer... However when I go into the serial monitor for some reason it is not printing out the temperature
const int sensorPin = A0;
const float baselineTemp = 20.0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
for (int pinNumber = 2; pinNumber<5; pinNumber++){
pinMode (pinNumber , OUTPUT);
digitalWrite (pinNumber , LOW);
}
}
void loop() {
// put your main code here, to run repeatedly:
int sensorVal = analogRead(sensorPin);
Serial.print("Sensor Value: ");
Serial.print(sensorVal);
float voltage = (sensorVal/1024.0)*5.0;// new value represents pins voltage
Serial.print(" , Volts: ");
Serial.print(voltage);
float temperature = (voltage - .5)*100;
Serial.println(temperature);
if(temperature<baselineTemp){
digitalWrite(2,LOW);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
}else if (temperature >=baselineTemp && temperature< baselineTemp+4){
digitalWrite(2,HIGH);
digitalWrite(3,LOW);
digitalWrite(4,LOW);
}else if (temperature >= baselineTemp +4 && temperature<baselineTemp+6){
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,LOW);
}else if (temperature >= baselineTemp +6){
digitalWrite(2,HIGH);
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
}
delay(1);
}
Other than that everything seems to be working fine.
also, on a side note; what does pinNumber++ do?
the book didn't really explain it and I had a hard time finding out on google so far.
sorry if this question has been asked a million times, I'm new to the forums as well as the Arduino and programming in general. Any help will be greatly appreciated, Thank you!