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 Team5_kode by
Diff: hack_motor.h
- Revision:
- 0:d3dbe632b1a9
diff -r 000000000000 -r d3dbe632b1a9 hack_motor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/hack_motor.h Mon Oct 31 09:57:07 2016 +0000 @@ -0,0 +1,30 @@ +#ifndef HACK_MOTOR_H +#define HACK_MOTOR_H +#include "mbed.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 \ No newline at end of file