Ignore a comandline

hi everyone, I'm new to this arduino world, I'm trying to make an elevator with a 360-degree motor, the first up command works, but I put a command to stop, and start descending, only he ignores these two commands, if anyone can send the most effective line of code for this case would be very grateful.

The way it works is you show us your code and THEN we will help you to get it right.

And since you haven't told us what motor you're using or how you're driving it or even what Arduino you have we couldn't write the code for you even if we wanted to.


#include <Servo.h>
Servo motor1;
Servo motor2;

void setup () {
void loop() {


void forward(){
motor1.write(180); //foward
void backward(){
motor2.write(105); //back
void right(){
motor1.write(180); //spin <—
delay(1000); //set time
void left(){
motor1.write(0); //spin <—
delay(1000); //set time
Motor: Servo Motor 360 degrees
Arduino: arduino duemilanove

So in setup() you attach 2 servos but do nothing with them.

In loop(), which is the part of the program that runs over and over again, you do nothing at all.

What are you expecting to happen? And when? And how?


Also you have delay(1000) all over the place and that is going to prevent your program from responding to other things. Have a look at how millis() is used to manage timing without blocking in Several things at a time.