hi everyone............
i'm new to arduino i was lately working on a project .
i faced a problem in my code, the problem is i can't use the button i attached to break the switch statment.
ie.
i have the following switch statment
if (Serial.available()>0 && sensorread==LOW)
{
int incomingserial = Serial.read();
switch (incomingserial)
{
case 'a':
Serial.print("This Is Case A");
digitalWrite(motor1, HIGH);
delay(500);
digitalWrite(motor1, LOW);
digitalWrite(transmitter, HIGH);
digitalWrite(buzzer1, HIGH);
break;
as you can see here is part of the switch statment i posted only this because the othr cases are the same but with different motor to rotate, the problem here is that i want to end this case when button1 is pressed so the transmitter and buzzer1 are on until button1 is pressed. when its pressed it goes to main loop.
other thing is that i have also a switchcase statment what i want to do is somehow the same as above ie.
if (Serial.available() > 0 && sensorread== HIGH)
{
int incomingserial = Serial.read();
switch (incomingserial) {
case 'a':
digitalWrite(transmitter,HIGH);
digitalWrite(buzzer,HIGH);
[here i want to insert code that if button2 is pressed turn of motor(x) then delay 500 break;
Please reply as soon as possible. with all my respect to all who will help me :%