Quantcast
Channel: Arduino Forum - Latest topics
Viewing all articles
Browse latest Browse all 15287

I need some coding help please

$
0
0

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

Read full topic


Viewing all articles
Browse latest Browse all 15287

Trending Articles