mirror of
https://github.com/ft-NotArt/ShyEye.git
synced 2025-10-29 04:25:59 +00:00
~ | Usefull Servo_reset function
This commit is contained in:
parent
3e3f009596
commit
b1e15b8b80
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
venv
|
||||
19
Servo_reset/Servo_reset.ino
Normal file
19
Servo_reset/Servo_reset.ino
Normal file
@ -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() {
|
||||
|
||||
}
|
||||
@ -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 ;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user