#include <Servo.h>

Servo servo1;  // Create a servo object
Servo servo2;  // Create a servo object
Servo servo3;  // Create a servo object
Servo servo4;  // Create a servo object


void setup() {
  Serial.begin(115200);
  servo1.attach(3);  // Attach the servo to pin 9
  servo2.attach(9);
  servo3.attach(5);
  servo4.attach(6);
  
  servo1.write(0);  // Move the servo to 0 degrees initially
  servo2.write(0);
  servo3.write(0);
  servo4.write(0);
  
  delay(1000);  // Wait for the servo to reach the initial position
}


void loop(){
  servo1_func("servo1");
  delay(2000);
  
  servo2_func("servo2");
  delay(2000);

  servo3_func("servo3");
  delay(2000);

  servo4_func("servo4");
  delay(2000);

  

}

void servo1_func(String servo_name) {
  servo1.write(180);  // Move the servo to 180 degrees
  delay(1000);  // Wait for the servo to reach the target position
  Serial.print("name:");
  Serial.println(servo_name);
  OnDrop();
  servo1.write(0);
  delay(1000);

}



void servo2_func(String servo_name) {
  servo2.write(180);  // Move the servo to 180 degrees
  delay(1000);  // Wait for the servo to reach the target position
  Serial.print("name:");
  Serial.println(servo_name);

  OnDrop();
  servo2.write(0);
  delay(1000);

}


void servo3_func(String servo_name) {
  servo3.write(180);  // Move the servo to 180 degrees
  delay(1000);  // Wait for the servo to reach the target position
  
  Serial.print("name:");
  Serial.println(servo_name);
  OnDrop();
  servo3.write(0);
  delay(1000);

}


void servo4_func(String servo_name) {
  servo4.write(180);  // Move the servo to 180 degrees
  delay(1000);  // Wait for the servo to reach the target position

  Serial.print("name:");
  Serial.println(servo_name);
  OnDrop();
  servo4.write(0);
  delay(1000);

}


void OnDrop(){
  Serial.println("message sent");
}