Maybe I'm misinformed about while loops, but from what I know, they're supposed to loop indefinitely under some condition and then break when that condition becomes false. When I start up my sketch, it gets to a while loop and gets stuck there even when the condition changes. Here is the code in question:
void hide() {
tone(piezo, 3000, 1000); //tones a piezo buzzer to signal start
delay(3000);
int val = volts(phTransistor); //assigns val to a function that calculates the voltage coming through a phototransistor
while (val == 0.00) { //while val is 0.00 volts in a pitch black room,
maneuver(200, 200, 1000); //drive servo car forward
maneuver(200, -200, 500); //turn servo car
}
//when while loop breaks, continue through function to the end
maneuver(0, 0, -1); //stops servos and detaches them
for (int i = 0; i < 5; i++) { //tone piezo 5 times to signal light was shined on phototransistor
tone(piezo, 3000, 500);
delay(550);
}
}
The servo car just keeps driving no matter how long I shine my light on it, and I'm 100% certain it is registering more than 0.00 volts.