•int val=255;
•int v_motor = 3; //vertical motor
•int h_motor = 5; //horizontal motor
•int f_motor = 6; //firing motor
•
•void setup() {
• Serial.begin(115200);
• Serial.println(F(“Enter the following command to control motors”));
• Serial.println(F(“1 – vertical motor”));
• Serial.println(F(“2 – horizontal motor”));
• Serial.println(F(“3 – firing motor”));
• Serial.println(F(“4 – motors stop”));
•}
•void loop() {
• int control = 0;
• control = Serial.read();
• if (control == ‘1’){
• Serial.println(F(“vertical motor is running”));
• analogWrite(v_motor, val);
•
• } else if (control == ‘2’){
• Serial.println(F(“horizontal motor is running”));
• analogWrite(h_motor, val);
•
• }else if (control == ‘3’){
• Serial.println(F(“firing motor is running”));
• analogWrite(f_motor, val);
•
• }else if(control == ‘4’){
• Serial.println(F(“motors stop”));
• analogWrite(v_motor, 0);
• analogWrite(h_motor, 0);
• analogWrite(f_motor, 0);
• }
•}