Kim Nielsen / Mbed 2 deprecated Endeligkildekode

Dependencies:   PID mbed

Fork of EndeligKildekode by E2016-S1-Team5

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers hack_motor.h Source File

hack_motor.h

00001 #include "mbed.h"
00002 #ifndef HACK_MOTOR_H
00003 #define HACK_MOTOR_H
00004 class Wheel {
00005 public:
00006     Wheel(PinName M1A_pin, PinName M1B_pin, PinName M2A_pin, PinName M2B_pin);
00007     ~Wheel();
00008     void FW(); // Forward
00009     void BW(); // Backwards
00010     void right(); // Right
00011     void left(); // Left
00012     void stop(); // Stop
00013     void init(); // Init
00014     void set_speed(float speed); // set your wanted speed (0..1.0)
00015     float get_speed(); // get the actual speed
00016     void FW(float right, float left); // Overload Forward with right motor speed, left motor speed
00017 private:
00018     float fw, bw;
00019     float speed;
00020     PwmOut *M1A;
00021     PwmOut *M2A;    
00022     DigitalOut *M1B; 
00023     DigitalOut *M2B;
00024 }; 
00025 #endif