Luis Bernal / Mbed 2 deprecated xbeat-hoppel-code

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers drive.h Source File

drive.h

00001 /*
00002  *
00003  * This program is free software; you can redistribute it and/or modify
00004  * it under the terms of the GNU General Public License as published by
00005  * the Free Software Foundation; either version 3 of the License, or
00006  * (at your option) any later version.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00015  *
00016  * @file drive.h
00017  * @author Andre Moehl
00018  * @date 01/2011
00019  * @brief Driver Class definition
00020  */
00021 
00022 #ifndef __DRIVE_H
00023 #define __DRIVE_H
00024 
00025 /*--- Includes ------------------------*/
00026 #include "mbed.h"
00027 #include "motor.h"
00028 
00029 //duty cycle for motor PWM in ms
00030 #define DUTYCYCLE 20
00031 // pulse width (us) for Motor stop
00032 #define ZERO 1500
00033 
00034 #define LEFT 1
00035 #define RIGHT 2
00036 
00037 class Drive
00038 {
00039     public:
00040     
00041         /** 
00042         *   @brief Constructor
00043         *   @parameter LeftPin Left Motorp Signal Pin 
00044         *   @parameter RightPin Right Motorp Signal Pin 
00045         */
00046         Drive(PinName LeftPin,PinName RightPin);
00047         /**
00048          * @ brief Sets the linear speed 
00049          * @parameter speed value between -100 and 100 % */
00050         void move(int left, int right);         
00051         /**
00052          * @brief sets the motor zero offset
00053          * @parameter left left motor offset
00054          * @parameter right right motor offset
00055          */
00056         void setoffset(int left, int right);      
00057         
00058     private:
00059         int curr_speed_L;
00060         int curr_speed_R;
00061         int offset_L, offset_R;
00062         Motor _Left;
00063         Motor _Right;
00064 };
00065 
00066 #endif