![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Microduino的cube小车。
Microduino_Motor.h
- Committer:
- lixianyu
- Date:
- 2016-05-25
- Revision:
- 2:70ca3e685cca
- Parent:
- 1:758ccab13947
- Child:
- 3:e4ac7c1a14de
File content as of revision 2:70ca3e685cca:
#ifndef Motor_h #define Motor_h //#include "Arduino.h" #include "mbed.h" #define CHAN_LEFT 0 #define CHAN_RIGHT 1 typedef struct { uint8_t nbr_A :6 ; uint8_t nbr_B :6 ; } MotorPin_t ; typedef struct { MotorPin_t Pin; } motor_t; class Motor { public: Motor(PinName _motor_pinA, PinName _motor_pinB); void Fix(float _fix); void Driver(int16_t _motor_driver); void Free(); void Brake(); int16_t GetData(int16_t _throttle, int16_t _steering, bool _dir); private: uint8_t motorIndex; // index into the channel data for this key float fix; int16_t _motor_vol; protected: gpio_t gpioA; gpio_t gpioB; }; #endif