Linear actuator servos

Hi team,
I am trying to move four linear actuator connected to their corresponding LAC with a UNO. Actuators are setup in parallel.
System works as expected with this code:

#include <Servo.h>


#define PIN_SERVO1   (9)
#define PIN_SERVO2   (8)
#define PIN_SERVO3   (7)
#define PIN_SERVO4   (6)
#define START_POSITION1  (1) //min 1
#define START_POSITION2  (1) //min 1
#define START_POSITION3  (1) //min 1
#define START_POSITION4  (1) //min 1
#define END_POSITION1  (80) //max 80
#define END_POSITION2  (80) //max 80
#define END_POSITION3  (80) //max 80
#define END_POSITION4  (80) //max 80

Servo myServo1;
Servo myServo2;
Servo myServo3;
Servo myServo4;

void setup() {
   // set servo
   myServo1.attach(PIN_SERVO1);
   myServo2.attach(PIN_SERVO2);
   myServo3.attach(PIN_SERVO3);
   myServo4.attach(PIN_SERVO4);
   
   //open serial window for log
   Serial.begin(9600);
}

void loop()
{
    
  SetStrokePerc(START_POSITION1);
  SetStrokePerc(START_POSITION2);
  SetStrokePerc(START_POSITION3);
  SetStrokePerc(START_POSITION4);
  Serial.println("START_POSITION");
  delay(10000);

  SetStrokePerc(END_POSITION1);
  SetStrokePerc(END_POSITION2);
  SetStrokePerc(END_POSITION3);
  SetStrokePerc(END_POSITION4);
  Serial.println("END_POSITION");
  delay(10000);
  
}

void SetStrokePerc(float strokePercentage)
{
  if ( strokePercentage >= 1.0 && strokePercentage <= 99.0 )
  {
    int usec = 1000 + strokePercentage * ( 2000 - 1000 ) / 100.0 ;
    myServo1.writeMicroseconds( usec );
    myServo2.writeMicroseconds( usec );
    myServo3.writeMicroseconds( usec );
    myServo4.writeMicroseconds( usec );
  }
}

They move up and down continuously so all good so far.

The next requirement is to be able to command the position of the actuators to different positions. For starters retracted and fully extended, so I modified the code to have the Serial Monitor capture the commands. The issue I am seeing is that the code seems to run linearly despite the if statements.

#include <Servo.h>


#define PIN_SERVO1   (9)
#define PIN_SERVO2   (8)
#define PIN_SERVO3   (7)
#define PIN_SERVO4   (6)
#define START_POSITION1  (1) //min 1
#define START_POSITION2  (1) //min 1
#define START_POSITION3  (1) //min 1
#define START_POSITION4  (1) //min 1
#define END_POSITION1  (80) //max 80
#define END_POSITION2  (80) //max 80
#define END_POSITION3  (80) //max 80
#define END_POSITION4  (80) //max 80

Servo myServo1;
Servo myServo2;
Servo myServo3;
Servo myServo4;

int input = 0; //initializing variable to home

void setup() {
   // set servo
   myServo1.attach(PIN_SERVO1);
   myServo2.attach(PIN_SERVO2);
   myServo3.attach(PIN_SERVO3);
   myServo4.attach(PIN_SERVO4);
   
   //open serial window for log
   Serial.begin(9600);
}

void loop()
{
  Serial.println("Action? (1, 2)");
  input = Serial.read(); 
  Serial.println(input); // for troubleshooting of what is the current command
  //delay(10001);

if(input = 1){
  SetStrokePerc(START_POSITION1);
  SetStrokePerc(START_POSITION2);
  SetStrokePerc(START_POSITION3);
  SetStrokePerc(START_POSITION4);
  Serial.println("START_POSITION");
  delay(5000); //delay to allow servos to move
  }
  
else if(input = 2){  
  SetStrokePerc(END_POSITION1);
  SetStrokePerc(END_POSITION2);
  SetStrokePerc(END_POSITION3);
  SetStrokePerc(END_POSITION4);
  Serial.println("END_POSITION");
  delay(5000); // delay to allow servos to move
    }
  }


void SetStrokePerc(float strokePercentage)
{
  if ( strokePercentage >= 1.0 && strokePercentage <= 99.0 )
  {
    int usec1 = 1000 + strokePercentage * ( 2000 - 1000 ) / 100.0 ;
    int usec2 = 1000 + strokePercentage * ( 2000 - 1000 ) / 100.0 ;
    int usec3 = 1000 + strokePercentage * ( 2000 - 1000 ) / 100.0 ;
    int usec4 = 1000 + strokePercentage * ( 2000 - 1000 ) / 100.0 ;
    myServo1.writeMicroseconds( usec1 );
    myServo2.writeMicroseconds( usec2 );
    myServo3.writeMicroseconds( usec3 );
    myServo4.writeMicroseconds( usec4 );
  }
}

The expectation would be for the servos to fully retract if "input" = 1 and extend if "input"= 2.

Any idea of where I am getting it wrong?

I have also tried using Case statements with a similar outcome.

Eventually I will want to be able to have the option to define specific positions so that will be part 3.

Thanks for the help.

A.

if(input = 1){

u mean

if(input == 1){

= is for assignment.
== is for comparison.
Getting these wrong is a common mistake.
Yes, experts may use = in a comparison but they know the ins and outs of the rules.

if(1 = input){

would have generated a compiler warning and presumably saved hours of confusion

  SetStrokePerc(START_POSITION1);
  SetStrokePerc(START_POSITION2);
  SetStrokePerc(START_POSITION3);
  SetStrokePerc(START_POSITION4);
  Serial.println("START_POSITION");
  delay(10000);

  SetStrokePerc(END_POSITION1);
  SetStrokePerc(END_POSITION2);
  SetStrokePerc(END_POSITION3);
  SetStrokePerc(END_POSITION4);
  Serial.println("END_POSITION");
  delay(10000);

Why call SetStrokePerc() four times when SetStrokePerc() sends each value to all four servos?!? If you EVER want the four servos to be in different positions you will need to change "SetStrokePerc()" so it knows which servo you are talking about. One way to do that is to make your own kind of 'Servo' which adds the "SetStrokePerc()" function to the Servo class.

#include <Servo.h>


class MyKindOfServo : public Servo
{
  public:
    void SetStrokePerc(float strokePercentage)
    {
      if ( strokePercentage >= 1.0 && strokePercentage <= 99.0 )
      {
        int usec = 1000 + strokePercentage * ( 2000 - 1000 ) / 100.0;
        writeMicroseconds(usec);
      }
    }
};


MyKindOfServo myServo1;
MyKindOfServo myServo2;
MyKindOfServo myServo3;
MyKindOfServo myServo4;

#define PIN_SERVO1   (9)
#define PIN_SERVO2   (8)
#define PIN_SERVO3   (7)
#define PIN_SERVO4   (6)


#define START_POSITION1  (1) //min 1
#define START_POSITION2  (1) //min 1
#define START_POSITION3  (1) //min 1
#define START_POSITION4  (1) //min 1
#define END_POSITION1  (80) //max 80
#define END_POSITION2  (80) //max 80
#define END_POSITION3  (80) //max 80
#define END_POSITION4  (80) //max 80

int input = 0;  //initializing variable to home


void setup()
{
  // set servo pins
  myServo1.attach(PIN_SERVO1);
  myServo2.attach(PIN_SERVO2);
  myServo3.attach(PIN_SERVO3);
  myServo4.attach(PIN_SERVO4);


  //open serial window for log
  Serial.begin(9600);
}


void loop()
{
  Serial.println("Action? (1, 2)");
  input = Serial.read();
  Serial.println(input);  // for troubleshooting of what is the current command
  //delay(10001);


  if (input == '1')
  {
    myServo1.SetStrokePerc(START_POSITION1);
    myServo2.SetStrokePerc(START_POSITION2);
    myServo3.SetStrokePerc(START_POSITION3);
    myServo4.SetStrokePerc(START_POSITION4);
    Serial.println("START_POSITION");
    delay(5000); //delay to allow servos to move
  }


  if (input == '2')
  {
    myServo1.SetStrokePerc(END_POSITION1);
    myServo2.SetStrokePerc(END_POSITION2);
    myServo3.SetStrokePerc(END_POSITION3);
    myServo4.SetStrokePerc(END_POSITION4);
    Serial.println("END_POSITION");
    delay(5000); // delay to allow servos to move
  }
}

aarg:

if(input = 1){

u mean

if(input == 1){

Indeed you are correct. I noticed as I was playing around with the code.
Thanks for this.

johnwasser:

  SetStrokePerc(START_POSITION1);

SetStrokePerc(START_POSITION2);
 SetStrokePerc(START_POSITION3);
 SetStrokePerc(START_POSITION4);
 Serial.println("START_POSITION");
 delay(10000);

SetStrokePerc(END_POSITION1);
 SetStrokePerc(END_POSITION2);
 SetStrokePerc(END_POSITION3);
 SetStrokePerc(END_POSITION4);
 Serial.println("END_POSITION");
 delay(10000);




Why call SetStrokePerc() four times when SetStrokePerc() sends each value to all four servos?!? If you EVER want the four servos to be in different positions you will need to change "SetStrokePerc()" so it knows which servo you are talking about. One way to do that is to make your own kind of 'Servo' which adds the "SetStrokePerc()" function to the Servo class.



#include <Servo.h>

class MyKindOfServo : public Servo
{
 public:
   void SetStrokePerc(float strokePercentage)
   {
     if ( strokePercentage >= 1.0 && strokePercentage <= 99.0 )
     {
       int usec = 1000 + strokePercentage * ( 2000 - 1000 ) / 100.0;
       writeMicroseconds(usec);
     }
   }
};

MyKindOfServo myServo1;
MyKindOfServo myServo2;
MyKindOfServo myServo3;
MyKindOfServo myServo4;

#define PIN_SERVO1   (9)
#define PIN_SERVO2   (8)
#define PIN_SERVO3   (7)
#define PIN_SERVO4   (6)

#define START_POSITION1  (1) //min 1
#define START_POSITION2  (1) //min 1
#define START_POSITION3  (1) //min 1
#define START_POSITION4  (1) //min 1
#define END_POSITION1  (80) //max 80
#define END_POSITION2  (80) //max 80
#define END_POSITION3  (80) //max 80
#define END_POSITION4  (80) //max 80

int input = 0;  //initializing variable to home

void setup()
{
 // set servo pins
 myServo1.attach(PIN_SERVO1);
 myServo2.attach(PIN_SERVO2);
 myServo3.attach(PIN_SERVO3);
 myServo4.attach(PIN_SERVO4);

//open serial window for log
 Serial.begin(9600);
}

void loop()
{
 Serial.println("Action? (1, 2)");
 input = Serial.read();
 Serial.println(input);  // for troubleshooting of what is the current command
 //delay(10001);

if (input == '1')
 {
   myServo1.SetStrokePerc(START_POSITION1);
   myServo2.SetStrokePerc(START_POSITION2);
   myServo3.SetStrokePerc(START_POSITION3);
   myServo4.SetStrokePerc(START_POSITION4);
   Serial.println("START_POSITION");
   delay(5000); //delay to allow servos to move
 }

if (input == '2')
 {
   myServo1.SetStrokePerc(END_POSITION1);
   myServo2.SetStrokePerc(END_POSITION2);
   myServo3.SetStrokePerc(END_POSITION3);
   myServo4.SetStrokePerc(END_POSITION4);
   Serial.println("END_POSITION");
   delay(5000); // delay to allow servos to move
 }
}

Very good point. I guess I had not gotten that far. Clearly this is a requirement.
What I tried to do as I was troubleshooting the code is take the actual command definitions out of the loop. It did not seem to make sense to have them in there when in fact, in the loop what I am looking for is the the system to continuously keep asking what I want to do next. This has fixed the continuous movement that I was observing on the HW.
Here is what I came up with:

//Initialize libraries and variables
#include <Servo.h>
#define PIN_SERVO1   (9)
#define PIN_SERVO2   (8)
#define PIN_SERVO3   (7)
#define PIN_SERVO4   (6)
#define START_POSITION1  (1) //min 1
#define START_POSITION2  (1) //min 1
#define START_POSITION3  (1) //min 1
#define START_POSITION4  (1) //min 1
#define END_POSITION1  (80) //max 80
#define END_POSITION2  (80) //max 80
#define END_POSITION3  (80) //max 80
#define END_POSITION4  (80) //max 80
//String input = "H";
int input = 2;
int Target11 (1);
float strokePercentage;

//Define Servos
Servo myServo1;
Servo myServo2;
Servo myServo3;
Servo myServo4;

void setup() {
   // set servo pins
   myServo1.attach(PIN_SERVO1);
   myServo2.attach(PIN_SERVO2);
   myServo3.attach(PIN_SERVO3);
   myServo4.attach(PIN_SERVO4);
   
   //open serial window for log
   Serial.begin(9600);
   
   //define actions
   Home();
   Target();
   Max();
}

void Home(){
      SetStrokePerc(START_POSITION1);
      SetStrokePerc(START_POSITION2);
      SetStrokePerc(START_POSITION3);
      SetStrokePerc(START_POSITION4);
      Serial.println("Moving to Home");
}

void Target(){    
      Serial.println("Servo1-1:?");
      Target11 = Serial.read();
      Serial.print(Target11); //for TS purposes
      SetStrokePerc(Target11);
      Serial.println("Moving to Target");
}

void Max(){    
      SetStrokePerc(END_POSITION1);
      SetStrokePerc(END_POSITION2);
      SetStrokePerc(END_POSITION3);
      SetStrokePerc(END_POSITION4);
      Serial.println("Moving to Max");
}

void loop(){ 
   //while (input != "Stop"){
    Serial.println("Action? (H, M, T, Stop)");
   input = Serial.read();
   Serial.print(input); //Command confirmation
   delay(8000);
   
   if (input == 1){
    Home();}
   if (input == 2){
    Max();}
   if (input == 3){
    Target();}
    
}

void SetStrokePerc(float strokePercentage)
{
  if ( strokePercentage >= 1.0 && strokePercentage <= 99.0 )
  {
    int usec = 1000 + strokePercentage * ( 2000 - 1000 ) / 100.0 ;
    myServo1.writeMicroseconds( usec );
    myServo2.writeMicroseconds( usec );
    myServo3.writeMicroseconds( usec );
    myServo4.writeMicroseconds( usec );
  }
}

What I am observing with this code which has me puzzled is what seems to be random positions. ie. when powered it might to to Max while no command has been given, or when I request move to max or a given position it does not seem to take the command despite it clearly recording the value.
Will try to incorporate your above suggestion to control independent servos in my next iteration.

Thanks for the help on this guys!
A.

      Target11 = Serial.read();

Serial.read() returns -1 if there are no characters in the input buffer.

   input = Serial.read();
   Serial.print(input); //Command confirmation
   delay(8000);
   
   if (input == 1){
    Home();}
   if (input == 2){
    Max();}
   if (input == 3){
    Target();

Do you have a program sending the serial input? If not, you probably want to look for characters:

   if (input == '1'){
    Home();}
   if (input == '2'){
    Max();}
   if (input == '3'){
    Target();

ah... that explains the -1 I was getting. Could not understand where that was coming from.

The 1, 2, 3 was an attempt to simplify the troubleshooting. I used to have "Home", "Max" and "Target" but then got tired of all that typing. Probably should use H, M, T.

Will consolidate the great feedback and comeback with the hw results.

Thanks

A.

I integrated suggestions and the code is behaving correctly. When I send 1 it goes to home, when I hit 2 (max) it goes to max and 3 to an intermediate position I defined.

The only two caveats are that when I load the SW to the Arduino it goes to some "random" intermediate position thought I have initialised input to 1 for it to go start in safety position (home).
second one is response time to commands is rather slow is rather slow. I am guessing caused by that 5 second delay I have in so it doesn't continuously print. Any thoughts on how to improve this?

Working code:

//Initialize libraries and variables
#include <Servo.h>
#define PIN_SERVO1   (9)
#define PIN_SERVO2   (8)
#define PIN_SERVO3   (7)
#define PIN_SERVO4   (6)
#define START_POSITION1  (1) //min 1
#define START_POSITION2  (1) //min 1
#define START_POSITION3  (1) //min 1
#define START_POSITION4  (1) //min 1
#define MID_POSITION1  (5) //any value
#define MID_POSITION2  (20) //any value
#define MID_POSITION3  (20) //any value
#define MID_POSITION4  (5) //any value
#define END_POSITION1  (80) //max 80
#define END_POSITION2  (80) //max 80
#define END_POSITION3  (80) //max 80
#define END_POSITION4  (80) //max 80

int input = '1';   //initializing variable to home

class MyKindOfServo : public Servo
{
  public:
    void SetStrokePerc(float strokePercentage)
    {
      if ( strokePercentage >= 1.0 && strokePercentage <= 99.0 )
      {
        int usec = 1000 + strokePercentage * ( 2000 - 1000 ) / 100.0;
        writeMicroseconds(usec);
      }
    }
};

//Define Servos
  MyKindOfServo myServo1;
  MyKindOfServo myServo2;
  MyKindOfServo myServo3;
  MyKindOfServo myServo4;


void setup() {
   // set servo pins
   myServo1.attach(PIN_SERVO1);
   myServo2.attach(PIN_SERVO2);
   myServo3.attach(PIN_SERVO3);
   myServo4.attach(PIN_SERVO4);
   
   //open serial window for log
   Serial.begin(9600);
}


void loop(){ 
   //while (input != "Stop"){
   Serial.println("Action? (1, 2, 3)");
   input = Serial.read();
   //Serial.print(input); //Command confirmation
   delay(5000);
   
   if (input == '1')
  {
    myServo1.SetStrokePerc(START_POSITION1);
    myServo2.SetStrokePerc(START_POSITION2);
    myServo3.SetStrokePerc(START_POSITION3);
    myServo4.SetStrokePerc(START_POSITION4);
    Serial.println("START_POSITION");
    delay(5000); //delay to allow servos to move
  }


  if (input == '2')
  {
    myServo1.SetStrokePerc(END_POSITION1);
    myServo2.SetStrokePerc(END_POSITION2);
    myServo3.SetStrokePerc(END_POSITION3);
    myServo4.SetStrokePerc(END_POSITION4);
    Serial.println("END_POSITION");
    delay(100); // delay to allow servos to move
  }

    if (input == '3')
  {
    myServo1.SetStrokePerc(MID_POSITION1);
    myServo2.SetStrokePerc(MID_POSITION2);
    myServo3.SetStrokePerc(MID_POSITION3);
    myServo4.SetStrokePerc(MID_POSITION4);
    Serial.println("MID_POSITION");
    delay(5000); // delay to allow servos to move
  }
}

asw79:
when I load the SW to the Arduino it goes to some "random" intermediate position thought I have initialised input to 1 for it to go start in safety position (home).

The default position is "90 degrees". If you want the servos to start at your 'start' position, use

void setup() {

    myServo1.SetStrokePerc(START_POSITION1);
    myServo2.SetStrokePerc(START_POSITION2);
    myServo3.SetStrokePerc(START_POSITION3);
    myServo4.SetStrokePerc(START_POSITION4);

   // set servo pins
   myServo1.attach(PIN_SERVO1);
   myServo2.attach(PIN_SERVO2);
   myServo3.attach(PIN_SERVO3);
   myServo4.attach(PIN_SERVO4);

asw79:
second one is response time to commands is rather slow is rather slow. I am guessing caused by that 5 second delay I have in so it doesn't continuously print. Any thoughts on how to improve this?

Use the File->Examples->02.Digital->BlinkWithoutDelay technique to display periodically.

Thanks so much John. It now works like a Charm.

I have been searching for other posts on the following but haven't found any that were really addressing this. Say I now wanted to allow the servos to take on n number of predefined intermediate positions. I could create n number of mid positions, which would not make much sense or create a way for the code to read some sort of table with the coordinates. Any thoughts? Maybe using a read CSV file or something of the sort is what I am thinking. I have never done anything like this on an Arduino so not even sure how I would even load the CSV onto it.

Here is the working code for all four linear P16 with LAC actuators:

//Initialise libraries and variables
#include <Servo.h>
#define PIN_SERVO1   (9)
#define PIN_SERVO2   (8)
#define PIN_SERVO3   (7)
#define PIN_SERVO4   (6)
#define START_POSITION1  (1) //min 1
#define START_POSITION2  (1) //min 1
#define START_POSITION3  (1) //min 1
#define START_POSITION4  (1) //min 1
#define MID_POSITION1  (5) //any value
#define MID_POSITION2  (20) //any value
#define MID_POSITION3  (20) //any value
#define MID_POSITION4  (5) //any value
#define END_POSITION1  (80) //max 80
#define END_POSITION2  (80) //max 80
#define END_POSITION3  (80) //max 80
#define END_POSITION4  (80) //max 80

int input = '1';   //initialising variable to home
int Target11 = '0'; //initialling variable to home

unsigned long previousMillis = 0;        // will store last time command was updated
const long interval = 1000;           // interval at which command is refreshed

class MyKindOfServo : public Servo
{
  public:
    void SetStrokePerc(float strokePercentage)
    {
      if ( strokePercentage >= 1.0 && strokePercentage <= 99.0 )
      {
        int usec = 1000 + strokePercentage * ( 2000 - 1000 ) / 100.0;
        writeMicroseconds(usec);
      }
    }
};

//Define Servos
  MyKindOfServo myServo1;
  MyKindOfServo myServo2;
  MyKindOfServo myServo3;
  MyKindOfServo myServo4;


void setup() {
   // set servo pins
   myServo1.attach(PIN_SERVO1);
   myServo2.attach(PIN_SERVO2);
   myServo3.attach(PIN_SERVO3);
   myServo4.attach(PIN_SERVO4);
   
   //open serial window for log
   Serial.begin(9600);

    myServo1.SetStrokePerc(START_POSITION1);
    myServo2.SetStrokePerc(START_POSITION2);
    myServo3.SetStrokePerc(START_POSITION3);
    myServo4.SetStrokePerc(START_POSITION4);
}


void loop(){ 

   unsigned long currentMillis = millis();
   
   if (currentMillis - previousMillis >= interval) 
   {
    // save the last time command was given
    previousMillis = currentMillis;
  
   Serial.println("Action? (1, 2, 3)");
   input = Serial.read();
   //Serial.print(input); //Command confirmation
   //delay(5000);
   }
   
   if (input == '1') 
   {
    myServo1.SetStrokePerc(START_POSITION1);
    myServo2.SetStrokePerc(START_POSITION2);
    myServo3.SetStrokePerc(START_POSITION3);
    myServo4.SetStrokePerc(START_POSITION4);
    Serial.println("START_POSITION");
    delay(5000); //delay to allow servos to move
  }


  if (input == '2')
  {
    myServo1.SetStrokePerc(END_POSITION1);
    myServo2.SetStrokePerc(END_POSITION2);
    myServo3.SetStrokePerc(END_POSITION3);
    myServo4.SetStrokePerc(END_POSITION4);
    Serial.println("END_POSITION");
    delay(100); // delay to allow servos to move
  }

    if (input == '3')
  {
    myServo1.SetStrokePerc(MID_POSITION1);
    myServo2.SetStrokePerc(MID_POSITION2);
    myServo3.SetStrokePerc(MID_POSITION3);
    myServo4.SetStrokePerc(MID_POSITION4);
    Serial.println("MID_POSITION");
    delay(5000); // delay to allow servos to move
  }
}

Once you have more than 2 items with names that differ only by a number you should switch to using arrays. For example, re-writing your sketch using arrays makes it 60 lines instead of 109 lines.

//Initialise libraries and variables
#include <Servo.h>


const byte ServoCount = 4;
const byte ServoPins[ServoCount] = {9, 8, 7, 6};


// Positions in percent of full throw:
const float StartPositions[ServoCount] = {1.0, 1.0, 1.0, 1.0};
const float MidPositions[ServoCount]   = {5.0, 20.0, 20.0, 5.0};
const float EndPositions[ServoCount]   = {80.0, 80.0, 80.0, 80.0};


class MyKindOfServo : public Servo
{
  public:
    void SetStrokePerc(float strokePercentage)
    {
      if ( strokePercentage >= 1.0 && strokePercentage <= 99.0 )
      {
        int usec = 1000 + (strokePercentage * (2000 - 1000) / 100.0);
        writeMicroseconds(usec);
      }
    }
};


//Define Servos
MyKindOfServo MyServos[ServoCount];


void SetPositions(const float positions[ServoCount])
{
  for (int i = 0; i < ServoCount; i++)
  {
    MyServos[i].SetStrokePerc(positions[i]);
  }
}


void setup()
{
  Serial.begin(115200);


  for (int i = 0; i < ServoCount; i++)
  {
    MyServos[i].SetStrokePerc(StartPositions[i]);
    MyServos[i].attach(ServoPins[i]);
  }


  Serial.println("Action? (1, 2, 3)");
}


void loop()
{
  if (Serial.available())
  {
    switch (Serial.read())
    {
      case '1': SetPositions(StartPositions); Serial.println("START_POSITION"); break;
      case '2': SetPositions(EndPositions);   Serial.println("END_POSITION"); break;
      case '3': SetPositions(MidPositions);   Serial.println("MID_POSITION"); break;
    }
  }
}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.