Library for the Seeed Studio Shield Bot

Dependents:   ShieldBotExample

SeeedStudioShieldBot.h

Committer:
melse
Date:
2013-07-15
Revision:
3:ccd47cdacb7b
Parent:
2:118efce95f3c
Child:
4:e2d5ac8459a4

File content as of revision 3:ccd47cdacb7b:

#include "mbed.h"

/** Seeed Studio Shield Bot Control Class
*/
class SeeedStudioShieldBot {
    public:
    
        // Create a shield bot object, using default settings for now...
        SeeedStudioShieldBot();
        
        /** Switch on the left motor at the given speed.
        */
        void left_motor(float speed);
        void right_motor(float speed);
        
        // Like the two above, but both at the same speed.        
        // Negative of either will do the same job as the other (hopefully...)
        void forward(float speed);
        void backward(float speed);
        
        // This will rotate both of the motors in opposite directions, at the same speed
        void left(float speed);
        void right(float speed);

        void disable_left_motor();
        void disable_right_motor();
        
        void enable_left_motor();
        void enable_right_motor();
        
        void stopAll();
        void stop(int motor);
        
        // Need to do something to do with detected line...
        
        float line_position();
        
        DigitalIn rightSensor;
        DigitalIn inRightSensor;
        DigitalIn centreSensor;
        DigitalIn inLeftSensor;
        DigitalIn leftSensor;
        
    private:
        PwmOut motor1A;
        DigitalOut motor1B;
        DigitalOut motor1En;
        
        // motor2A or motor2B need to be PWM, but the freedom board doesn't support it at the moment...
        PwmOut motor2A;
        DigitalOut motor2B;
        DigitalOut motor2En;
};