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 PRO1 by
hack_motor.h
00001 #ifndef HACK_MOTOR_H 00002 #define HACK_MOTOR_H 00003 #include "mbed.h" 00004 00005 class Wheel { 00006 00007 public: 00008 00009 Wheel(PinName M1A_pin, PinName M1B_pin, PinName M2A_pin, PinName M2B_pin); 00010 ~Wheel(); 00011 void FW(); // Forward 00012 void BW(); // Backwards 00013 void right(); // Right 00014 void left(); // Left 00015 void stop(); // Stop 00016 void init(); // Init 00017 void set_speed(float speed); // set your wanted speed (0..1.0) 00018 float get_speed(); // get the actual speed 00019 void FW(float right, float left); // Overload Forward with right motor speed, left motor speed 00020 00021 private: 00022 float fw, bw; 00023 float speed; 00024 PwmOut *M1A; 00025 PwmOut *M2A; 00026 DigitalOut *M1B; 00027 DigitalOut *M2B; 00028 }; 00029 00030 #endif
Generated on Tue Jul 12 2022 22:02:46 by
