Arduino Projects Book

Hello, Can someone help me out. I just started programming my Arduino Uno micro controller and anytime I try to verify or download the program I get this errors :

sketch_sep_Test2.ino:9:2: error: 'Serial' does not name a type
sketch_sep_Test2.ino:13:1: error: expected declaration before '}' token

below is the program:

const int sensorPin = A0;
const float baselineTemp = 20.0;

void setup();
// open serial port
Serial.begin(9600);

}for(int pinNumber = 2; pinNumbers<5; pinNumber++){
pinMode(pinNumer,OUTPUT);
digitalWrite(PinNumber, LOW);
}
}
void loop(){;
int sensorVval = 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:")
Sserial.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);

}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);
}

and I have the same error for this one as well. Thank you for your help.

void setup()
// put your setup code here, to run once:

;
}

void loop() {
// put your main code here, to run repeatedly:

;
}

int switchState = 0;

void setup() {
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
pinMode(2, OUTPUT);
}
void loop() {
switchState = digitalRead(2);
// this is a comment
if (switchState == LOW) {
// THE BUTTON IS NOT PRESSED

digitalWrite(3, HIGH);
digitalWrite(4, LOW);
digitalWrite(5, LOW);
;
}

else { // the button is pressed
digitalWrite(3, LOW);
digitalWrite(4, LOW);
digitalWrite(5, HIGH);

delay(250);
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
delay(250);
};
}

You need an opening { for setup:

void setup()
{ << this one is missing
// code
}
void loop()
{
//code
}

Crossroads said : You need an opening "{" for setup:..............and there shouldn't be any semi-column at the end of the line, when opening a function.

Example:

void setup() {
}

You had : "void setup();" ...

This obviously applies to all of the functions, especially void setup() and void setup() .

One last thing, make absolutely sure that the curly brackets ({ and }) are paired.
One "{" to open a function, and a matching "}" to close the function
It is is extremely easy to have one missing, it'll generate errorts and this is the kind of error that is difficult to locate.

This is probably overkill, but because I am definitely (still) on the learning curve, I personally comment the end of which function, like this :

void setup() {
  // initialize serial:
  Serial.begin(9600);
  // reserve 200 bytes for the inputString:
  inputString.reserve(200);
//end of void setup() function
}