File tree 1 file changed +55
-0
lines changed
1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * this doesn't seem to be working
3
+ #if defined(XIAO_ESP32S3) || defined(XIAO_ESP32C3) //if esp32s3 or esp32C3
4
+ #include <ESP32Servo.h>
5
+ #else // all other Arduino boards
6
+ // #include <Servo.h>
7
+ #endif
8
+ */
9
+
10
+
11
+ // #include <ESP32Servo.h> // esp32
12
+ #include < Servo.h> // most arduinos
13
+
14
+ Servo myServoPin01;
15
+ int servoPin = 2 ; // D2
16
+
17
+ void setup () {
18
+ Serial.begin (115200 );
19
+ pinMode (LED_BUILTIN, OUTPUT);
20
+ digitalWrite (LED_BUILTIN, LOW); // high off onboard LED
21
+
22
+ myServoPin01.attach (servoPin, 1000 , 2000 );
23
+ delay (10000 );
24
+ digitalWrite (LED_BUILTIN, HIGH); // high off onboard LED
25
+
26
+ Serial.println (" Time to control an ESC Motor driver" );
27
+ }
28
+
29
+ void loop () {
30
+
31
+ myServoPin01.writeMicroseconds (0 ); // not realy needed
32
+ delay (500 );
33
+ myServoPin01.writeMicroseconds (1500 ); // middle not really needed
34
+ delay (1000 );
35
+
36
+ digitalWrite (LED_BUILTIN, LOW);
37
+ myServoPin01.writeMicroseconds (1600 ); // slow forward
38
+ Serial.println (" Slow forward" );
39
+ delay (1000 );
40
+
41
+ digitalWrite (LED_BUILTIN, HIGH); // high off onboard LED
42
+ myServoPin01.writeMicroseconds (0 );
43
+ delay (500 );
44
+ myServoPin01.writeMicroseconds (1500 ); // middle
45
+ delay (1000 );
46
+ myServoPin01.writeMicroseconds (1400 ); // slow reverse
47
+
48
+ Serial.println (" Slow backward" );
49
+ delay (1000 );
50
+
51
+
52
+ Serial.println (" Wait 5 seconds" );
53
+ delay (5000 );
54
+
55
+ }
You can’t perform that action at this time.
0 commit comments