Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
include/motor.hpp
- Committer:
- calamaridudeman
- Date:
- 2013-11-24
- Revision:
- 28:21773a6fb6df
- Parent:
- 26:53b793b7a82f
- Child:
- 29:33c5c61f1068
- Child:
- 35:a4e89e78d034
File content as of revision 28:21773a6fb6df:
#include "mbed.h" #include "QEI.h" #ifndef MOTOR_HPP #define MOTOR_HPP class Motor { public: Motor(PinName aPin, PinName fPin, PinName bPin, PinName pwmPin, QEI &enc); void start(); void stop(); void setTorque(float t); void Control(); int getPos(); float getCurrent(); static float filterLowPass(float old, float currentIn, float alphar); void setPos(float pos); void setVel(float vel); void setPosVel(float pos, float vel); void zero(); float kp; float kd; private: Ticker t; AnalogIn aIn; DigitalOut Forward; DigitalOut Backward; PwmOut pwmOut; QEI encoder; float speed; float freq; float pos; float angle; float voltage; int mode; float dAngularVelocity; float dAngle; float dTorque; }; #endif