Hi all; I have included a while statement in my software.
while (a=1023){
a = analogRead(A0);
}
Serial.println(a);
What should be happening is while the analog read is 1023 you cannot exit the while statement which is what I want. The reading at AO is changing all the time but usually at a low. So what should be happening is that you get a print out of 'a' when exiting the while statement.
Higher up in the program the value of 'a' is shown. There is no print out of 'a' in the serial monitor after the while loop. I conclude from this that there must be something wrong in the while loop so that the program cannot continue.
Has any body got an insight into why the program is not working?
while (a=1023){
a = analogRead(A0);
}
Serial.println(a);
What should be happening is while the analog read is 1023 you cannot exit the while statement which is what I want. The reading at AO is changing all the time but usually at a low. So what should be happening is that you get a print out of 'a' when exiting the while statement.
Higher up in the program the value of 'a' is shown. There is no print out of 'a' in the serial monitor after the while loop. I conclude from this that there must be something wrong in the while loop so that the program cannot continue.
Has any body got an insight into why the program is not working?