keyestudio WiKi
/*
Keyestudio ESP32 Robot Arm
8-6 Servo Configuration
Function: set servo at pin IO17 to the angle of 90°
http://www.keyestudio.com
*/
#include
<ESP32Servo.h>
// create a servo objects Customizable name
Servo servo;
int
servoPin
=
17;
//Connect servo to pin IO17
void
setup()
{
servo.attach(servoPin);
servo.write(0);
//Set servo angle to 0°
delay(1000);
servo.write(180);
delay(1000);
servo.write(90);
}
void
loop() {
}
After uploading the code, the servo will initialize to 0° first. Then it rotates from 0 to 180° and then it maintains at 90°.
We need to ensure the servo is at 90° position before installing.
Vertically mount it as follows:
62
//Set servo angle to 180°
//Set servo angle to 90°
Chapter 8. 8. Assembly
Need help?
Do you have a question about the ESP32 and is the answer not in the manual?
Questions and answers