keyestudio WiKi
9.4.3.2 Code
Download codes: Codes
Download and unzip the file. Open the corresponding code file. Code file for Chapter 9.4.3.2 is named 9-4-3-2.
Modify SSID and PASS into your own wifi name and passwords:
const
char
*SSID
=
"your_SSID";
const
char
*PASS
=
"your_PASSWORD";
Code:
/*
Keyestudio ESP32 Robot Arm
9-4-3-2 tutorial code
Function: connect ESP32 to wifi to check IP address. Visit the address to enter
control panel to control the arm wirelessly
http://www.keyestudio.com
*/
#include
<WiFi.h>
#include
<WebServer.h>
#include
<ESP32Servo.h>
/*ATTENTION:
ESP32 only supports wifi at a frequency of 2.4GHz.
If wifi fails to be connected, please check wifi name, passwords and frequency.
Modify "your_SSID " into your wifi name
Modify "your_PASSWORD" into your wifi passwords*/
const
char*
ssid
=
const
char*
password
WiFiServer server(80);
to access the web page without entering the port number
#define basePin 16
#define armPin 17
#define forearmPin 2
#define gripperPin 4
Servo base;
// create servo object to control a servo
Servo arm;
Servo forearm;
Servo gripper;
int
baseAngle, armAngle, forearmAngle, gripperAngle;
current Angle of the servo
int
slider1Value
=
90;
int
slider2Value
=
90;
int
slider3Value
=
90;
152
"your_SSID";
=
"your_PASSWORD";
//Set the web port to 80. You can directly enter the IP
//set base servo pin to IO16
//set upper arm servo pin to IO17
//set forearm servo pin to IO2
//set claw servo pin to IO4
// Default position
// Default position
// Default position
//A variable used to store
Chapter 9. 9. Robot Arm Projects
a␣
address␣
the␣
(continues on next page)
Need help?
Do you have a question about the ESP32 and is the answer not in the manual?
Questions and answers