Keyestudio ESP32 Manual page 108

Smart robot arm kit
Hide thumbs Also See for ESP32:
Table of Contents

Advertisement

keyestudio WiKi
/*
Keyestudio ESP32 Robot Arm
8-12 Servo Configuaration
Function: set servo at pin IO16 to the angle of 90°
http://www.keyestudio.com
*/
#include
<ESP32Servo.h>
// create a servo objects Customizable name
Servo servo;
int
servoPin
=
16;
//Connect servo to pin IO16
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.
104
//set servo angle to 180°
//set servo angle to 90°
Chapter 8. 8. Assembly

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ESP32 and is the answer not in the manual?

Related Products for Keyestudio ESP32

Table of Contents