do loop

How do I get out of this do loop?

void getMileMarker(){
// 100's .....................................
do
{
lcd.clear();
lcd.setCursor(0,1);
lcd.print("MileMarker=");
thisString=itoa(mileMarkerW, buf,10);// + "." );// + itoa(mileMarkerD,buf,10));
thisString = thisString + ".";
thisString = thisString + itoa(mileMarkerD,buf, 10);
lcd.print(thisString );//+ "."+mileMarkerD);
lcd.setCursor(0,0);
lcd.print("DOWN 100's UP");
getButtonPress();
getDigitValues();
if (buttonStateTemp==1)
{
if(hDigit != 0)
{
mileMarkerW =( mileMarkerW-100);
}
}
else if (buttonState2Temp==1)
{
if(hDigit !=9)
{
mileMarkerW =( mileMarkerW+100);
}
}

}
while (digitalRead(menuPin)==0);
do

I can increase or decrease the 100's digit, but can not move to the next 10's digit.

GrandpaJay

Well, the best way to get out of that one would be to get the menuPin HIGH.

Thank you
The menuPin does go high, but the program does not drop thru.
Jay

Also, the menuPin A3 works in earlier parts of the program.
Jay

(p.s. It's a "do..while" loop, not a "do loop". Just for future reference if you are searching google for things etc.)

Hi Jay, and welcome.

Try this (click !) this should be of help to you, and us as well.

If you want to exit the loop, learn what the "break" keyword does.

Hi,
You show only a portion of your sketch, how many do..while do you have?
It looks like yu start another one after the segment you show.
Please post all your code, so we can get the big picture.

Thanks.. Tom... :slight_smile:

Sorry for the delay.
Yes there are several do..while loops. I am trying to set up a mile marker number between 999.9 and 0.1. The first loops sets the 100's column by moving the digit up or down. The menuPin is suposed to exit the loop when it goes high. The next loop does the same with the 10's column.

If I break out of the 100's column, I get to the 10's loop and get hung up there.

The menuPin A3 does go high.

This program was written by d. bodnar. And has a lot of unused information in it.

Jay

Wheel_Defect_Counter.ino (29 KB)