How to run two selected program

Hello,

i need some help with my programming. this my final year project and im not master on the coding. what i trying to do is to run 2 kinds of mode which in Manual and Auto, when it been selected the coding will run at their specific process.

int MNL = 40; //Manual Operation
int AUTO = 41; //Auto Operation
int RUN1 = HIGH;
int RUN2 = HIGH;

void setup() {
Serial.begin(9600); // begin serial communitication
Serial.println(“Motor test!”);
pinMode(MNL, INPUT); //manual
pinMode(AUTO, INPUT); //auto
}

void loop() {

if (RUN1 == HIGH) {

Serial.println (“Bluetooth on!”);
delay (250);
}

else if (RUN2 == HIGH); {

Serial.println (“Auto on!”);
delay (250);
}
}

this is not my actual coding but it similar. when i upload this, the monitor will display both functions. please, i really need a help.

(deleted)

Where are the values for RUN1 and RUN2 intended to come from?

What is supposed to happen if both RUN1 and RUN2 are LOW?

To my mind it would be more sensible to have a single value which can be either HIGH or LOW and then you could have

if (RUN1 == HIGH)  {
  Serial.println ("Bluetooth on!");
  delay (250);
}

else  {
  Serial.println ("Auto on!");
  delay (250);
}

For the future please use the code button </> when posting code.

…R
Planning and Implementing a Program

oppss did see that. thanks for the help. my code just works the way i wanted. RUN1 and RUN2 have come from the MNL and AUTO i forgot to declare it at the void loop().

int MNL = 40; //Manual Operation int AUTO = 41; //Auto Operation int RUN1 = HIGH; int RUN2 = HIGH;

void setup() { Serial.begin(9600); // begin serial communitication Serial.println("Motor test!"); pinMode(MNL, INPUT); pinMode(AUTO, INPUT); }

void loop() {

RUN1 = digitalRead(MNL); RUN2 = digitalRead(AUTO);

if (RUN1 == HIGH) {

Serial.println ("Bluetooth on!"); delay (250); }

else if (RUN2 == HIGH) {

Serial.println ("Auto on!"); delay (250); }

}