Keyestudio ESP32 Manual page 157

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

Advertisement

int
slider4Value
=
90;
void
setup() {
Serial.begin(9600);
base.attach(basePin);
arm.attach(armPin);
forearm.attach(forearmPin);
gripper.attach(gripperPin);
delay(100);
// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to
Serial.println(ssid);
//initialize Wifi
WiFi.begin(ssid, password);
//search wifi. while loop: if no wifi is connected, keep searching; state: connecting
while
(WiFi.status()
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi
// Start the server
server.begin();
Serial.println("Server
// Print the IP address
Serial.print("IP Address:
Serial.println(WiFi.localIP());
base.write(90);
delay(100);
arm.write(90);
delay(100);
forearm.write(90);
delay(100);
gripper.write(90);
delay(100);
}
void
loop() {
WiFiClient client
WiFi server and assign it to a WiFiClient object named client
if
(!client) {
the connection from the client was successfully accepted. If not, exit
immediately
return;
}
// Serial.println("New client");
while
(!client.available()) {
request and the data is available. While waiting, the code is delayed at 1
9.4. 9.4 WiFi Control Robot Arm
// Default position
// Connect base to pin 2
// Connect arm to pin 4
// Connect forearm to pin 5
// Connect gripper to pin 18
");
!=
WL_CONNECTED) {
connected.");
started");
");
//initialize base servo angle to 90 degree
//initialize upper arm servo angle to 90 degree
//initialize forearm servo angle to 90 degree
//initialize claw servo angle to 90 degree
=
server.available();
//The loop will wait until the client has sent
//Try to accept a request coming in from
//This conditional statement checks
keyestudio WiKi
(continued from previous page)
the␣
whether␣
execution␣
the␣
millisecond␣
(continues on next page)
153

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?

Questions and answers

Subscribe to Our Youtube Channel

Related Products for Keyestudio ESP32

Table of Contents