This week, I helped Grade 2 students turn their handmade bridges into auto-lifting bridges by showing them what coding is, how programming drives a servo motor, what Arduino is, and how it works.
I was also explore what is ESP32 how powerful it is including spercifications,features power pins
1.Arduino workflow: I tested on the cirkit designer by adding the components and then make the simulation. The Servo library is included to control the Servo motor. The Servo is attached to pin D5. The setup() function initializes the Servo at 0 degrees. The loop() function gradually moves the Servo to 45 degrees and then back to 0 degrees, with a delay to control the speed of rotation.
What is servo motor and what does it do? How Servo Motors work and how to control servos using Arduino.
2.What is ESP32? ESP32 is highly-integrated with in-built antenna switches, RF balun, power amplifier, low-noise receive amplifier, filters, and power management modules. ESP32 adds priceless functionality and versatility to your applications with minimal Printed Circuit Board (PCB) requirements. Hybrid Wi-Fi & Bluetooth Chip.
This week, I worked on using Arduino to build an auto-lifting bridge and explored how to use the ESP32.
#include
Servo myServo; // Create a Servo object
void setup() {
myServo.attach(5); // Attach the Servo to pin D5
myServo.write(0); // Start at 0 degrees
delay(1000); // Wait for the servo to reach the position
}
void loop() {
// Rotate to 45 degrees slowly
for (int pos = 0; pos <= 45; pos++) {
myServo.write(pos); // Move to the position
delay(15); // Wait for the servo to reach the position
}
delay(1000); // Hold at 45 degrees for a second
// Return to 0 degrees slowly
for (int pos = 45; pos >= 0; pos--) {
myServo.write(pos); // Move to the position
delay(15); // Wait for the servo to reach the position
}
delay(1000); // Hold at 0 degrees for a second
}