From df4a4dd63b704327295199706979be95ab91caae Mon Sep 17 00:00:00 2001 From: k0xxx Date: Wed, 20 Apr 2022 23:25:44 +0300 Subject: [PATCH] upd --- src/main.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 2c763cf..c7371a7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -43,22 +43,22 @@ void loop() { digitalWrite(0, HIGH); digitalWrite(1, HIGH); - // for(servoTmpAngle = 0; servoTmpAngle < servoTargetAngle; servoTmpAngle += 1) // goes from 0 degrees to 180 degrees - // { // in steps of 1 degree - // servoControl.write(servoTmpAngle); // tell servo to go to position in variable 'pos' - // delay(servoRefresh); // waits 20ms for refresh period - // SoftRcPulseOut::refresh(1); // generates the servo pulse - // } + for(servoTmpAngle = 0; servoTmpAngle < servoTargetAngle; servoTmpAngle += 1) // goes from 0 degrees to 180 degrees + { // in steps of 1 degree + servoControl.write(servoTmpAngle); // tell servo to go to position in variable 'pos' + delay(servoRefresh); // waits 20ms for refresh period + SoftRcPulseOut::refresh(1); // generates the servo pulse + } } else { servoAngle = servoDefaultAngle; digitalWrite(0, LOW); digitalWrite(1, LOW); - // for(servoTmpAngle = servoTargetAngle; servoTmpAngle>=1; servoTmpAngle-=1) // goes from 180 degrees to 0 degrees - // { - // servoControl.write(servoTmpAngle); // tell servo to go to position in variable 'pos' - // delay(servoRefresh); // waits 20ms for for refresh period - // SoftRcPulseOut::refresh(1); // generates the servo pulse - // } + for(servoTmpAngle = servoDefaultAngle; servoTmpAngle>=1; servoTmpAngle-=1) // goes from 180 degrees to 0 degrees + { + servoControl.write(servoTmpAngle); // tell servo to go to position in variable 'pos' + delay(servoRefresh); // waits 20ms for for refresh period + SoftRcPulseOut::refresh(1); // generates the servo pulse + } }