diff options
author | Jonas Smedegaard <dr@jones.dk> | 2023-10-12 10:54:36 +0200 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2023-10-12 10:54:36 +0200 |
commit | 7db8282e33568d217d1fd24968d4432b91e93622 (patch) | |
tree | 66ef13bf0ab861fd64c38242def4ba39140e5f3d | |
parent | 9499f9994fff0a6e6a2b1799b7997369b5e11640 (diff) |
add link to servo source; simplify: drop unused servo_mode
-rw-r--r-- | main.ino | 10 |
1 files changed, 2 insertions, 8 deletions
@@ -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); |