summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--main.ino10
1 files changed, 2 insertions, 8 deletions
diff --git a/main.ino b/main.ino
index 1027d96..f7066d3 100644
--- a/main.ino
+++ b/main.ino
@@ -86,8 +86,6 @@ int servo_angle_delta = 3;
const int servo_angle_min = 0;
const int servo_angle_max = 90;
-const int servo_mode = 1;
-
int servo_should_move = 0;
void setup() {
@@ -205,20 +203,16 @@ void printData() {
}
#endif
+// source: https://robojax.com/learn/arduino/?vid=robojax_Servo_PB1_move_return
void servoLoop() {
if (servo_should_move == 1) {
servo_angle = servo_angle + servo_angle_delta;
if (servo_angle >= servo_angle_max) {
servo_angle_delta = -servo_angle_delta;
- if (servo_mode == 1) {
- servo_should_move = 0;
- }
+ servo_should_move = 0;
}
if (servo_angle <= servo_angle_min) {
servo_angle_delta = -servo_angle_delta;
- if (servo_mode == 2) {
- servo_should_move = 0;
- }
}
servo.write(servo_angle);
delay(10);