Skip to content

Commit 5172cfe

Browse files
committed
activate the servos
1 parent d148a4f commit 5172cfe

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

ArduinoClassRobot.ino

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,24 @@
2121
2222
https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
2323
*/
24-
24+
#include <ESP32Servo.h>
25+
Servo left;
26+
Servo right;
2527
// the setup function runs once when you press reset or power the board
2628
void setup() {
27-
// initialize digital pin LED_BUILTIN as an output.
28-
pinMode(LED_BUILTIN, OUTPUT);
29+
left.attach(33);
30+
right.attach(32);
31+
left.write(90);
32+
right.write(90);
33+
2934
}
3035

3136
// the loop function runs over and over again forever
3237
void loop() {
33-
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
38+
left.write(0);
39+
right.write(0);
3440
delay(1000); // wait for a second
35-
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
41+
left.write(180);
42+
right.write(180);
3643
delay(1000); // wait for a second
3744
}

0 commit comments

Comments
 (0)