From: eaman Date: Sat, 18 Mar 2017 10:23:08 +0000 (+0100) Subject: lib base X-Git-Url: http://git.piffa.net/web?p=rover;a=commitdiff_plain;h=360fe05c792050f24d1ca7308016338e72e7798a lib base --- diff --git a/libraries/rover/rover.h b/libraries/rover/rover.h index 1fcaa5c..acde54f 100644 --- a/libraries/rover/rover.h +++ b/libraries/rover/rover.h @@ -13,6 +13,39 @@ Licenza: GPLv3 #ifndef rover_h #define rover_h +////////////////////// +// OBJ + + +class engine { +// Gestione di un singolo motore +private: + byte enablePIN1; + byte enablePIN2; + byte min; // Minimo per partire + byte val; // 8bit PWM + +public: + Engine (byte PIN1, byte PIN2, byte PINPWM); + void Forward (); + void Backward (); + void SetSpeed (); // imposta un valore preciso per il PWM + +} + +class motors { +// classe composta da due engines +// Composition is better than inheritance here + +public: + motors (engine enginesx, engine enginedx) { + void Forward (); + void Backward (); + void TurnLeft (); + void TurnRight (); + void TurnU (); +} +} ////////////////////// // Funzioni