motor i senzor

Dependencies:   TextLCD mbed PinDetect

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Motor.h Source File

Motor.h

00001 #ifndef MOTOR_H
00002 #define MOTOR_H
00003 
00004 #include "mbed.h"
00005 
00006 #define motorDriveTime          100    // vrijeme koje se motor kreće, u milisekundama.
00007 #define motorPwmPeriod          0.010   // PWM period to 10 ms
00008 #define motorPwmInitDutyCycle   0.5     // PWM initial duty cycle, 50%
00009 #define motorPwmWaitTime        0.02    // PWM wait time in sec.
00010 #define motorPwmChangeSpeed     0.2     // PWM value change
00011 
00012 class Motor {
00013 
00014 private:
00015     DigitalOut positiveOut, negativeOut;
00016     PwmOut pwmOut;
00017     short direction;    
00018     void start();
00019 
00020 public:
00021     Motor(PinName, PinName, PinName);
00022     void movePositive();
00023     void moveNegative();
00024     void stop(); 
00025     bool isMoving();   
00026     
00027 };
00028 
00029 #endif