summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2023-10-12 10:54:36 +0200
committerJonas Smedegaard <dr@jones.dk>2023-10-12 10:54:36 +0200
commit7db8282e33568d217d1fd24968d4432b91e93622 (patch)
tree66ef13bf0ab861fd64c38242def4ba39140e5f3d
parent9499f9994fff0a6e6a2b1799b7997369b5e11640 (diff)
add link to servo source; simplify: drop unused servo_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);