// wokwi resluts: OK
//ESP32 S3 TEST:
// ESP IS NOT WORKING THE SAME LIKE ARDUINO
// يختلف عن الأردوينو في طريقة عمل الوظيفة
// حيث لابد من تسمية السيرفو باسم مختلف لكل مخرج
// the letters (x,y) does not affect the names of the servos ...
// ...they are only integer numbers.
// the letters (s,t) they affect the resluts.
#include <ESP32Servo.h>
void setup() {
int x=1;
int y=2;
int s=18;
int t=19;
int servoPin;
int val;
int servo[2]={18,19};
Servo servox;
Servo servoz;
Servo servoy;
//myservo.attach(18);
//servox=servoz; // attaches the servo on pin 18 to the servo object
servoz.attach(s, 500, 2400); // attaches the servo on pin 18 to the servo object
// using SG90 servo min/max of 500us and 2400us
val= 0; // the resetting value of (val) is 90
//Serial.print ("Position Value= ");
//Serial.println(val);
//myservo.write(val);
servoz.write(val);
delay(1000);
servoz.detach(); // فصل محرك السيرفو عن المسمار
// ثم ربطه بالمسمار الجديد
//servoy=servoz;
servoz.attach(t, 500, 2400); // attaches the servo on pin 18 to the servo object
// using SG90 servo min/max of 500us and 2400us
val= 180; // the resetting value of (val) is 90
//Serial.print ("Position Value= ");
//Serial.println(val);
//myservo.write(val);
servoz.write(val);
delay(1000); // delay time for the servo to go to the set position
}
void loop() {}