Return servos to main position

Hi, I am doing a sketch that is something like this, I declare the main position of servo and a force sensitive resistor reading, then when the fsr detects a force move to one position, there are 4 possible movements, the problem is that I try the sketch and there are not the results I want, help me please, I ll be very thankful. Here is the code: and a written explication.

#include <Servo.h>

int fsrPin = 0;
int fsrReading;

Servo myservo4;
Servo myservo5;
Servo myservo6;

void setup(){
   Serial.begin(9600);
   
  myservo4.attach(7);
  myservo5.attach(5);
  myservo6.attach(6);
  myservo4.write(90);
  myservo5.write(180);
  myservo6.write(180);
  
}
  
  void loop(){
    
  fsrReading = analogRead(fsrPin);
  Serial.print ("FSR Reading = ");
  Serial.print(fsrReading);
  delay(1100);
  
    if (fsrReading < 5){
    myservo4.write(90);
    myservo5.write(180);
    myservo6.write(180);
    }
  if (fsrReading > 440 && fsrReading < 470) {
    myservo4.write(120);
    delay(2000);
    myservo6.write(0);
    delay(500);
    myservo6.write(180);
    delay(500);
    myservo6.write(0);
  }
    
   if (fsrReading > 455 && fsrReading < 576){
     myservo5.write(20);
  myservo4.write(0);
  delay(1000);
  myservo6.write(0);
  delay(500);
  myservo6.write(180);
    delay(500);
    myservo6.write(0);
    
}

if (fsrReading > 50 && fsrReading < 340) { 
  myservo4.write(65);
  delay(1000);
  myservo5.write(10);
  delay(1000);
  myservo6.write(0);
  delay(1000);
   myservo6.write(180);
    delay(500);
    myservo6.write(0);
}

if (fsrReading > 576) {
  myservo4.write(175);
  delay(1000);
  myservo6.write(0);
  delay(1000);
   myservo6.write(180);
    delay(500);
    myservo6.write(0);
}
  }

So what do you want to happen?
Code will only do what you tell it to.

I want to know how to return the three servos to main postion after that the fsr detects a force and the secuence of movements are done.

I use myservo.write( 90 or 180) to declare that that was the main position but how to return to it
Thanks.

Do these again.

  myservo4.write(90);
  myservo5.write(180);
  myservo6.write(180);

You didn't declare them as a 'main' position, just as the starting position when the sketch runs.

I want to know how to return the three servos to main postion after that the fsr detects a force and the secuence of movements are done.

I am puzzled about what is puzzling you.
You simply use:-

 myservo4.write(90);

at the place in the code where you want this to happen.
So for servo 4 then

if (fsrReading > 440 && fsrReading < 470) {
    myservo4.write(120);
    delay(2000);
    myservo6.write(0);
    delay(500);
    myservo6.write(180);
    delay(500);
    myservo6.write(0);
// return the servo
myservo4.write(90);
  }

However I think you need to define when you want the servo to return and remember that loop() is a loop and repeats continuously so that unless the force is removed then the servos will continue to move as programmed.

Thanks, I will put an else
{ myservo4. write(90);
myservo5.write(180);
myservo6.write(180);
}

And yes, the force will be removed so it can continue searching forces in the main position.

Gerdelamora:
Hi, I am doing a sketch that is something like this, I declare the main position of servo and a force sensitive resistor reading, then when the fsr detects a force move to one position, there are 4 possible movements, the problem is that I try the sketch and there are not the results I want, help me please, I ll be very thankful. Here is the code: and a written explication.

I see that you have three servos as outputs and one analog input connected to a pressure sensitive resister. You're carrying out a sequence of servo movements triggered by the input being within certain ranges of values.

It looks broadly sensible, but I have no idea whether it will do what you intend because you haven't said what it is intended to do, or what it actually does.

Is your analog input being read correctly and detected as being within the range you intend? This would be obvious if you added some print statements to the relevent code blocks.

Are your servos all wired and configured correctly so that they move correctly when you command them to a new position?

Do you intend the servos to go through these sequences repeatedly while the input is within the corresponding range, or is this only intended to happen when the load enters the corresponding range?

You have some delays during the sequences but do not consistently delay after the sequence, so it's quite likely that the loop would restart the sequence and move the servos before they had completed moving to the last position in the sequence.

Okay I will apply four Serial.print each per argument.
When the fsr detects a force (four possible forces) depending on this move to the desired position ( four possible positions), just when the if becomes true, after arrive to desired position return to initial position, this is basically what I want, I will do this by adding an else after each if I think this need to work.
Thanks