Im trying to do Project 6 in the Arduino projects book but I keep getting the same error and i could really use some help. here the error "Compilation error: 'SensorValue' was not declared in this scope" and here's my code:
int sensorValue;
int sensorLow = 1023;
int sensorHigh = 0;
const int LedPin = 8;
void setup() {
pinMode(LedPin, OUTPUT);
digitalWrite(LedPin, HIGH);
while (millis() < 5000) {
sensorValue = analogRead(A0);
if (SensorValue > sensorHigh) {
sensorHigh = sensorValue;
}
if (sensorValue < sensorLow) {
sensorLow = sensorValue;
}
}
digitalWrite(LedPin, LOW);
}
void loop() {
sensorValue = analogRead(A0);
int pitch =
map(sensorValue, sensorLow, sensorHigh, 50, 4000);
tone(8,pitch,20);
delay(10);
}
5 posts - 3 participants