You have too many }'s in the end of your code. You could easily spot this out if you hit [ctrl + T] which auto-formats your code.
AWOL:
Is the print in the book unclear or really small?
It's not too bad...
Remove the comma after sensorVal.
heres what i have now--
Arduino: 1.7.10 (Windows 8.1), Board: "Arduino Uno"
L0M_Arduino_Task_3.ino:56:1: error: expected declaration before '}' token
Error compiling.
const int sensorPin = A0;
const float baselineTemp = 20.0;
void setup() {
Serial.begin(9600); // open a serial port
for(int pinNumber = 2; pinNumber<5; pinNumber++) {
pinMode(pinNumber, OUTPUT);
digitalWrite(pinNumber, LOW);
}
}
void loop() {
int sensorVal = analogRead(sensorPin);
Serial.print("Sensor Value: ");
Serial.print(sensorVal);
// convert the ADC reading to voltage
float voltage = (sensorVal/1024.0) * 5.0;
Serial.print(", Volts: ");
Serial.print(voltage);
Serial.print(", degrees C: ");
// convert the voltage to tempeartire in degrees
float temperature = (voltage - .5) * 100;
Serial.println(temperature);
if(temperature < baselineTemp){
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
}else if(temperature >= baselineTemp+2 &&
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);
}
}
Read previous reply #20.
Start using code tags.
I can't force you to read the readme, but I can give you a time out to give you the opportunity.
Unfortunately (for you) the shortest time out I can give is a day.
Where'd you get 1.7.10?
The Arduino.cc IDE is only at 1.6.9:
Are you mixing up with Arduino,org IDE?
honestly im really confused rn. Just plz tell me what i need to do to get rid of the 1 error message i have left--
Arduino: 1.7.10 (Windows 8.1), Board: "Arduino Uno"
L0M_Arduino_Task_3.ino:56:1: error: expected declaration before '}' token
Error compiling.
const int sensorPin = A0;
const float baselineTemp = 20.0;
void setup() {
Serial.begin(9600); // open a serial port
for (int pinNumber = 2; pinNumber < 5; pinNumber++) {
pinMode(pinNumber, OUTPUT);
digitalWrite(pinNumber, LOW);
}
}
void loop() {
int sensorVal = analogRead(sensorPin);
Serial.print("Sensor Value: ");
Serial.print(sensorVal);
// convert the ADC reading to voltage
float voltage = (sensorVal / 1024.0) * 5.0;
Serial.print(", Volts: ");
Serial.print(voltage);
Serial.print(", degrees C: ");
// convert the voltage to tempeartire in degrees
float temperature = (voltage - .5) * 100;
Serial.println(temperature);
if (temperature < baselineTemp) {
digitalWrite(2, LOW);
digitalWrite(3, LOW);
digitalWrite(4, LOW);
} else if (temperature >= baselineTemp + 2 &&
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);
}
}
Remove the last }
Are code tags really that hard to understand?
thank u thats all i needed.
Thanks for all the help, it compiled (and i read the readme)
Peace
AWOL:
Are code tags really that hard to understand?
lmao.