I'm having some issues (I think) with a for loop, and break().
I read in the documentation this example:
int threshold = 40;
for (int x = 0; x < 255; x++) {
analogWrite(PWMpin, x);
sens = analogRead(sensorPin);
if (sens > threshold) { // bail out on sensor detect
x = 0;
break;
}
delay(50);
}
Looks okay, but why is that line
x=0;
in there?
It's going back to zero next time the for loop is entered isn't it?