]> git.piffa.net Git - rover/commitdiff
Sistemati gli include della lib Servo.h
authorAndrea Manni <andrea@piffa.net>
Wed, 5 Apr 2017 10:51:46 +0000 (12:51 +0200)
committerAndrea Manni <andrea@piffa.net>
Wed, 5 Apr 2017 10:51:46 +0000 (12:51 +0200)
libraries/rover/rover.cpp
libraries/rover/rover.h
prototypes/servo/rotation_lib/rotation_lib.ino

index f284162b970330d6352509e4194283434c4b5b18..d95fe065190912808ab355e57e2843965a97bd73 100644 (file)
@@ -24,8 +24,17 @@ const int enB = 5;
 const int in3 = 4;
 const int in4 = 3;
 byte speedB = 255;
-// Funzioni
 
+// Servo vars
+int pos = 0;    // variable to store the servo position 
+const byte servoPIN =9 ;
+const byte middle = 90; // Centratura servo
+const int spausa = 30; // Pausa movimenti servo
+Servo myservo; // Non c'e' bisogno di extern se e' dichiarato in questo scope
+
+////////////////////////
+// Funzioni:
+//
 void abilita() {
 // Abilita i PINs come OUTPUTS
     pinMode(enA, OUTPUT);
@@ -34,6 +43,10 @@ void abilita() {
     pinMode(enB, OUTPUT);
     pinMode(in3, OUTPUT);
     pinMode(in4, OUTPUT);
+
+
+    pinMode(servoPIN, OUTPUT);
+    myservo.attach(servoPIN);
 }
 
 
index a4ad42bd1b6bdf73b51b084a43cc70ca568f2af5..ce72cdbfecb6524dc0ae1640b0f3dc90d3d4f8da 100644 (file)
@@ -9,6 +9,7 @@ Licenza:    GPLv3
 */
 
 #include "Arduino.h"
+#include "Servo.h" 
 
 #ifndef rover_h
 #define rover_h
index 130d38dd1ea4e6ce67e2b71d8e1740753c292f8a..763e8f2d3e52aa9ce4cbed7ac5b1dbb2610acc86 100644 (file)
 
 
 #include <rover.h>
-#include <Servo.h> 
+#include "Servo.h" 
 
-Servo myservo;  // create servo object to control a servo 
 // a maximum of eight servo objects can be created 
 
-// Servo vars
-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
 
 void setup() 
 {