Stray Errors | Genuino Starter Kit

Hi everyone,

I just got started with my Genuino Starter Kit.
The first two projects went perfectly fine but now I have some problems with project 3 (temperature sensor).

Here is my code:

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

void setup() {
  Serial.begin(9600);

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



float voltage = (sensorVal/1024.0) * 5.0;

Serial.print(", Volts: ");
Serial.print(voltage);
Serial.print(", degrees C: ");

float temperature = (voltage - .5) * 100;
Serial.println(temperature);

if (temperature < baselineTemp+2) {
  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);

}

That is the code shown in the projects book.
But then I get the following error message:

Arduino: 1.6.8 (Mac OS X), Board: "Arduino/Genuino Uno"

P3:7: error: stray '\302' in program
 for(int pinNumber = 2; pinNumber<5; pinNumber++) {
 ^
P3:7: error: stray '\240' in program
exit status 1
stray '\302' in program

Does somebody know how to fix this problem?
Any help would be very much appreciated!

Cheers,

There are some hidden bad characters in your program. You should be able to fix it by selecting the code you posted above and then paste it into a new sketch.

[OP, but new account]

pert:
There are some hidden bad characters in your program. You should be able to fix it by selecting the code you posted above and then paste it into a new sketch.

Thank you very much, it actually worked!

Tractorbeam:
[OP, but new account]

Why?

AWOL:
Why?

Oh, nothing special, just didn't like the old name :smiley: Not that the new is much better... :smiley:

I've deleted the old account before posting here but somehow I was still logged into the old account that's why didn't start the thread with the new account.

You can't delete your account