X-Git-Url: http://git.piffa.net/web?p=rover;a=blobdiff_plain;f=prototypes%2Fservo%2Frotation_func%2Frotation_func.ino;fp=prototypes%2Fservo%2Frotation_func%2Frotation_func.ino;h=5a660c35542d29b3a6381e3ff226db6770641983;hp=ac463ea979d0071cde7aed1a80680d0de0c65a2f;hb=ead54f309e696c5befa132582375f54dd97b8b10;hpb=bf3cd5f43d63b7cf20a5cd37002fea4d246dcd89 diff --git a/prototypes/servo/rotation_func/rotation_func.ino b/prototypes/servo/rotation_func/rotation_func.ino index ac463ea..5a660c3 100644 --- a/prototypes/servo/rotation_func/rotation_func.ino +++ b/prototypes/servo/rotation_func/rotation_func.ino @@ -29,12 +29,16 @@ int pos = 0; // variable to store the servo position const byte servo =9 ; const byte middle = 90; // Centratura servo const int spausa = 30; // Pausa movimenti servo +const byte left = 170; +const byte right = 10; void setup() { myservo.attach(servo); // attaches the servo on pin 9 to the servo object - myservo.write(middle); // tell servo to go to position in variable 'pos' - delay(2000); + + // Centratura iniziale + myservo.write(middle); // tell servo to go to position in variable 'pos' + delay(2000); } @@ -48,24 +52,24 @@ void loop() delay(1000); // Turn SX - turnSX(); - delay(1000); - - turnMiddle(); - delay(1000); + turnSX(); + delay(1000); + + turnMiddle(); + delay(1000); } // Functions void turnDX() { // TurnDX - myservo.write(170); + myservo.write(right); delay(spausa); } void turnSX() { // TurnSX - myservo.write(10); + myservo.write(left); delay(spausa); }