We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 90ef20f commit 7b3db98Copy full SHA for 7b3db98
rocking-servo/rocking-servo.ino
@@ -1,7 +1,7 @@
1
#include <Servo.h>
2
3
-#define START_ANGLE 45
4
-#define STOP_ANGLE 150
+#define START_ANGLE 90
+#define STOP_ANGLE 120
5
#define LOOP_DELAY 250
6
#define SRV_PIN 9
7
#define SPD_PIN A0
@@ -13,7 +13,7 @@ const int loopDelay = LOOP_DELAY;
13
const int srvPin = SRV_PIN;
14
const int spdPin = SPD_PIN;
15
16
-const int stepAngle = 10;
+const int stepAngle = 1;
17
18
Servo srv;
19
@@ -35,15 +35,13 @@ int getSpd() {
35
}
36
37
int getStepDelay(int spd) {
38
- return 100 - 10*spd;
+ return (10 - spd) * 2;
39
40
41
-
42
int pos = startAngle;
43
int spd = 0;
44
bool fw = true;
45
46
47
void loop() {
48
spd = getSpd();
49
0 commit comments