You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Note that the wire polarity on the motor does not matter because DC motors' spin direction is based on the direction of current flowing through them.
55
+
* Note that the wire polarity on the motor does not matter because DC motors' spin direction is based on the direction of current flowing through them. This direction is controlled by the H-bridge motor driver.
56
56
57
57
<br>
58
58
59
59
| Motor Controller Terminal | ESP32 Pin |
60
60
|:-------------|:------------------|
61
-
|5V| 5V |
61
+
|VCC| 5V |
62
62
| IN1 | Any PWM enabled pin |
63
63
| IN2 | Any PWM enabled pin |
64
64
@@ -92,6 +92,8 @@ void loop() {
92
92
digitalWrite(IN2, LOW);
93
93
94
94
delay(1000); // Stop for 1 second
95
+
96
+
vTaskDelay(1); // Yield CPU to not starve other ESP32 processes and cause WDT reset
95
97
}
96
98
```
97
99
Again, more detailed information about the DRV8833 motor controllers can be [found here!](https://lastminuteengineers.com/drv8833-arduino-tutorial/)
@@ -102,7 +104,7 @@ Again, more detailed information about the DRV8833 motor controllers can be [fou
102
104
103
105
## What Are Servos?
104
106
105
-
Servos are motors that are designed for precise position control. Instead of freely rotating when powered, servos listen to a control signal (usually [PWM](https://learn.sparkfun.com/tutorials/pulse-width-modulation/all)) to determine where to rotate. Some servos offer limited rotation (like 0°–180°), while others can rotate continuously (like ours). More advanced servos have other ways to be even more precise such as a feedback system on top of the control signal, but that is not necessary for this competition.
107
+
Servos are motors that are designed for precise position control. Instead of freely rotating when powered, servos listen to a control signal (usually [PWM](https://learn.sparkfun.com/tutorials/pulse-width-modulation/all)) to determine where to rotate. Some servos rotate continuously, while others rotate with a fixed angle range (like ours). More advanced servos have other ways to be even more precise such as a feedback system on top of the control signal, but that is not necessary for this competition.
106
108
107
109
## How to Use Servos?
108
110
@@ -132,11 +134,15 @@ Servo myServo;
132
134
133
135
voidsetup() {
134
136
myServo.attach(12);
135
-
myServo.write(1750);
136
137
}
137
138
138
139
voidloop() {
140
+
myServo.write(0); // Rotate to 0 degrees
141
+
delay(1000); // Delay 1000 ms
142
+
myServo.write(180); // Rotate to 180 degrees
143
+
delay(1000);
139
144
145
+
vTaskDelay(1); // Yield CPU to not starve other ESP32 processes and cause WDT reset
0 commit comments