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.
Fork of Robotkode by
hack_motor.h
- Committer:
- kimnielsen
- Date:
- 2016-12-09
- Revision:
- 7:a852e63cac3d
- Parent:
- 0:d3dbe632b1a9
File content as of revision 7:a852e63cac3d:
#include "mbed.h"
#ifndef HACK_MOTOR_H
#define HACK_MOTOR_H
class Wheel {
public:
Wheel(PinName M1A_pin, PinName M1B_pin, PinName M2A_pin, PinName M2B_pin);
~Wheel();
void FW(); // Forward
void BW(); // Backwards
void right(); // Right
void left(); // Left
void stop(); // Stop
void init(); // Init
void set_speed(float speed); // set your wanted speed (0..1.0)
float get_speed(); // get the actual speed
void FW(float right, float left); // Overload Forward with right motor speed, left motor speed
private:
float fw, bw;
float speed;
PwmOut *M1A;
PwmOut *M2A;
DigitalOut *M1B;
DigitalOut *M2B;
};
#endif
