Anyway, here's my code. It never exits the DO-While loop no matter what I set the voltage to that pin to be. The console will display all values properly between 0 and 5v, and I vary the voltage all across there.
I'm expecting it to exit the DO-While loop whenever the voltage goes above 3 volts, but even at 5 volts, it just stays right where it is.
float voltage = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
// while (! Serial); // Wait untilSerial is ready - Leonardo
}
void loop() {
do
{
// read the input on analog pin 1:
int sensorValue = analogRead(A1);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage = sensorValue * (5.0 / 1023.0);
// print out the value you read:
Serial.println("Inside DO loop");
Serial.println(voltage);
} while (voltage < 3.00);
Serial.println("Outside DO Loop");
}