Programacion de Arduino

Hola muy buenos días, tengo a cargo la programación de un motor paso a paso con Arduino UNO. Los movimientos básicos los tengo. Puedo regular la velocidad en sentido horario y anti horario junto con la cantidad de vueltas que hace... Esas serían las variables necesarias para mi caso... Mí pregunta es la siguiente, necesitaría poder desde Arduino con "Monitor Serie" poder apagar y prender el motor por así decirlo y poder controlar las variables antes mencionadas... Alguien sabe como poder hacerlo?

CODIGO:

//definicion de pins
const int motorPin1 = 8;    // 28BYJ48 In1
const int motorPin2 = 9;    // 28BYJ48 In2
const int motorPin3 = 10;   // 28BYJ48 In3
const int motorPin4 = 11;   // 28BYJ48 In4
                  
//definicion variables
int motorSpeedapagado = 0;
int motorSpeedsentidohorario = 1500;   //variable para fijar la velocidad (cuanto disminuyo mas rapido es)
int motorSpeedsentidoantihorario = 5000;
int stepCounter = 0;     // contador para los pasos
int stepsPerRev = 500;  // pasos para una vuelta completa (modificar aca para poder variar la carrera)


//secuencia media fase
const int numSteps = 8;
const int stepsLookup[8] = { B1000, B1100, B0100, B0110, B0010, B0011, B0001, B1001 };


void setup()
{
 //declarar pines como salida
 pinMode(motorPin1, OUTPUT);
 pinMode(motorPin2, OUTPUT);
 pinMode(motorPin3, OUTPUT);
 pinMode(motorPin4, OUTPUT);
}


void loop()
{
 for (int i = 0; i < stepsPerRev * 2; i++)
 {
   clockwise();
   delayMicroseconds(motorSpeedsentidohorario);
 }
 for (int i = 0; i < stepsPerRev * 2; i++)
 {
   anticlockwise();
   delayMicroseconds(motorSpeedsentidoantihorario);
 }
 delay(0);
}

void clockwise()
{
 stepCounter++;
 if (stepCounter >= numSteps) stepCounter = 0;
 setOutput(stepCounter);
}

void anticlockwise()
{
 stepCounter--;
 if (stepCounter < 0) stepCounter = numSteps - 1;
 setOutput(stepCounter);
}

void setOutput(int step)
{
 digitalWrite(motorPin1, bitRead(stepsLookup[step], 0));
 digitalWrite(motorPin2, bitRead(stepsLookup[step], 1));
 digitalWrite(motorPin3, bitRead(stepsLookup[step], 2));
 digitalWrite(motorPin4, bitRead(stepsLookup[step], 3));
}

I've deleted your other cross post @sobanskigerman.

Cross posting is against the rules of the forum. The reason is that duplicate posts can waste the time of the people trying to help. Someone might spend 15 minutes writing a detailed answer on this thread, without knowing that someone else already did the same in the other thread.

Repeated cross posting will result in a suspension from the forum.

In the future, please take some time to pick the forum section that best suits the topic of your question and then only post once to that forum section. This is basic forum etiquette, as explained in the sticky "How to use this forum - please read." post you will find at the top of every forum section. It contains a lot of other useful information. Please read it.

Thanks in advance for your cooperation.