I have just started programming with the Arduino Uno and have had good success using the examples that came with the kit. I am trying to expand on the projects but I am having a trouble with the sketch. I get an Error message"ledPin2 was not declared in this scope" . Can any one point out what I am missing?
int sensorPin1 = 0;
int ledPin1 = 13;
int ledpin2 = 12;
int sensorValue1 = 0;
void setup()
{
pinMode(ledPin1, OUTPUT);
pinMode(ledPin2, OUTPUT);
Serial.begin(9600);
}
void loop()
{
int threshold1 = 150;
int threshold2 = 180;
if(analogRead(sensorPin1) > threshold1){ digitalWrite(ledPin1, HIGH);}
else{ digitalWrite(ledPin1, LOW);}
if(analogRead(sensorPin1) > threshold2){ digitalWrite(ledPin2, HIGH);}
else{ digitalWrite(ledPin2, LOW);}
float temperature = getVoltage(sensorPin1);
temperature = (temperature - .5) * 100;
Serial.println(temperature);
delay(1000);
}
float getVoltage(int pin){
return (analogRead(pin) * .004882814);
}