From 7db8282e33568d217d1fd24968d4432b91e93622 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Thu, 12 Oct 2023 10:54:36 +0200 Subject: add link to servo source; simplify: drop unused servo_mode --- main.ino | 10 ++-------- 1 file 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); -- cgit v1.2.3