Before I posted reply #16, I did a little test to verify that what I was saying was correct.
I modified gonanf_2's code to print out the value of 'R', as well as a message to say ', R == HIGH' if the condition (R == HIGH) was met.
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(A0, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
int R = analogRead(A0);
Serial.print(R);
Serial.print("");
if (R == HIGH) {
Serial.print(", R == HIGH");
}
Serial.println();
delay(10);
}
and here are the results:
The message ', R == HIGH' is only printed when R = 1.
I won't bother showing the other 970 or so values of R that don't print the message ', R == HIGH'.
