I want my program to work like when you select one item then they ask you to press button to confirm. My project is vending machine , I have 3 items to choose. Then first when select the 3rd items I want it to ask you for confirmation the when you press button to confirm. It ask to recheck (need to confirm again) after that the rest of the sequence work.
case 3:
if (digitalRead(pressing == 1)) {
lcd.clear();
lcd.setCursor(0, 0);
Serial.println("EMERGENCY ONLY");
lcd.setCursor(0, 1);
Serial.println("CONFIRM ?");
Serial.println("MASSAGE ALERT CONFIRM 1 PRESS BUTTON");
if (digitalRead(pressing == 2)) {
lcd.clear();
lcd.setCursor(0, 0);
Serial.println("ARE YOU SURE ?");
lcd.setCursor(0, 1);
Serial.println("CONFIRM ?");
Serial.println("MASSAGE ALERT CONFIRM 2 PRESS BUTTON");
if (digitalRead(pressing == 3)) {
servo3.writeMicroseconds(2000); //Rotate CW
delay(960);
servo3.writeMicroseconds(1500); //Stop
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Status : Item 3");
lcd.setCursor(0, 1);
lcd.print("is delivered");
delay(3000);
Serial.println("CHECK3");
delay(5000);
} else; {
break;
}
} else; {
break;
}
(I have 3 switch which 3 of them for selection items.)