From b1e15b8b80b5eb5f480eb4cbe53d9292fca4087c Mon Sep 17 00:00:00 2001 From: NotArt Date: Fri, 7 Mar 2025 05:32:28 +0100 Subject: [PATCH] ~ | Usefull Servo_reset function --- .gitignore | 1 + Servo_reset/Servo_reset.ino | 19 +++++++++++++++++++ Servo_test/Servo_test.ino | 26 -------------------------- 3 files changed, 20 insertions(+), 26 deletions(-) create mode 100644 .gitignore create mode 100644 Servo_reset/Servo_reset.ino delete mode 100644 Servo_test/Servo_test.ino diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5ceb386 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +venv diff --git a/Servo_reset/Servo_reset.ino b/Servo_reset/Servo_reset.ino new file mode 100644 index 0000000..0f22dcb --- /dev/null +++ b/Servo_reset/Servo_reset.ino @@ -0,0 +1,19 @@ +#include "Servo.h" + +#define START_POS 90 + +Servo servoX ; +Servo servoY ; + +void setup() { + servoX.attach(9) ; // attache le servoX au pin 9 + servoY.attach(10) ; // attache le servoY au pin 10 + + servoX.write(START_POS) ; + servoY.write(START_POS) ; + delay(1000) ; +} + +void loop() { + +} \ No newline at end of file diff --git a/Servo_test/Servo_test.ino b/Servo_test/Servo_test.ino deleted file mode 100644 index 71d6e11..0000000 --- a/Servo_test/Servo_test.ino +++ /dev/null @@ -1,26 +0,0 @@ -#include "Servo.h" - -Servo servo1 ; -Servo servo2 ; - -void setup() { - servo1.attach(9) ; // attache le servo1 au pin 9 - servo2.attach(10) ; // attache le servo2 au pin 10 - - servo1.write(0) ; - servo2.write(0) ; - delay(1000) ; - -} - -void loop() { - static int a = 0 ; - a += 5 ; - servo1.write(a) ; - servo2.write(a) ; - delay(100) ; - if (a == 0) - delay(1000) ; - else if (a == 180) - a = -5 ; -} \ No newline at end of file