Go Down

Topic: Error compiling, help muchos appreciated :) (Read 1 time) previous topic - next topic

Roboteeronepoinzerp

Hey all,

Sorry to post such a simple thing. I've read, re-read, and re-read (about 10 times) and just can;t see where I'm going wrong. If you can, I'd owe you a million dollars if you help (after I build my first robot huge corporation).

Here's my error message:




sketch_apr12a.ino: In function 'void loop()':
sketch_apr12a.ino:45:2: error: 'esle' was not declared in this scope
sketch_apr12a.ino:45:7: error: expected ';' before 'if'
sketch_apr12a.ino:55:10: error: expected ';' before 'if'
Error compiling.

Here's my code:


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 temperature 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);
   
 }
 
 esle if (temperature >= baselineTemp+4 &&
 temperature < baselineTemp+6)
 
 {
   digitalWrite(2, HIGH);
   digitalWrite(3, HIGH);
   digitalWrite(4, LOW);
   
    }
   
    esle if (temperature >= baselineTemp+6)
    {
   digitalWrite(2, HIGH);
   digitalWrite(3, HIGH);
   digitalWrite(4, HIGH);
 }
 delay(1);
}

Roboteeronepoinzerp

hooray!!!! I figured it out. I can't spell else properly. I win a million dollars!

Go Up