Library for the Seeed Studio Shield Bot
SeeedStudioShieldBot.h@2:118efce95f3c, 2013-07-15 (annotated)
- Committer:
- melse
- Date:
- Mon Jul 15 13:47:09 2013 +0000
- Revision:
- 2:118efce95f3c
- Parent:
- 1:5c40f2a5e1ac
- Child:
- 3:ccd47cdacb7b
added more docs
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
melse | 0:227158f56a11 | 1 | #include "mbed.h" |
melse | 0:227158f56a11 | 2 | |
melse | 0:227158f56a11 | 3 | class SeeedStudioShieldBot { |
melse | 0:227158f56a11 | 4 | public: |
melse | 0:227158f56a11 | 5 | |
melse | 0:227158f56a11 | 6 | // Create a shield bot object, using default settings for now... |
melse | 0:227158f56a11 | 7 | SeeedStudioShieldBot(); |
melse | 0:227158f56a11 | 8 | |
melse | 2:118efce95f3c | 9 | /** Switch on the left motor at the given speed. |
melse | 2:118efce95f3c | 10 | */ |
melse | 0:227158f56a11 | 11 | void left_motor(float speed); |
melse | 0:227158f56a11 | 12 | void right_motor(float speed); |
melse | 0:227158f56a11 | 13 | |
melse | 0:227158f56a11 | 14 | // Like the two above, but both at the same speed. |
melse | 0:227158f56a11 | 15 | // Negative of either will do the same job as the other (hopefully...) |
melse | 0:227158f56a11 | 16 | void forward(float speed); |
melse | 0:227158f56a11 | 17 | void backward(float speed); |
melse | 0:227158f56a11 | 18 | |
melse | 0:227158f56a11 | 19 | // This will rotate both of the motors in opposite directions, at the same speed |
melse | 0:227158f56a11 | 20 | void left(float speed); |
melse | 0:227158f56a11 | 21 | void right(float speed); |
melse | 0:227158f56a11 | 22 | |
melse | 2:118efce95f3c | 23 | void disable_left_motor(); |
melse | 2:118efce95f3c | 24 | void disable_right_motor(); |
melse | 0:227158f56a11 | 25 | |
melse | 2:118efce95f3c | 26 | void enable_left_motor(); |
melse | 2:118efce95f3c | 27 | void enable_right_motor(); |
melse | 0:227158f56a11 | 28 | |
melse | 0:227158f56a11 | 29 | void stopAll(); |
melse | 2:118efce95f3c | 30 | void stop(int motor); |
melse | 0:227158f56a11 | 31 | |
melse | 0:227158f56a11 | 32 | // Need to do something to do with detected line... |
melse | 0:227158f56a11 | 33 | |
melse | 1:5c40f2a5e1ac | 34 | float line_position(); |
melse | 0:227158f56a11 | 35 | |
melse | 0:227158f56a11 | 36 | DigitalIn rightSensor; |
melse | 0:227158f56a11 | 37 | DigitalIn inRightSensor; |
melse | 0:227158f56a11 | 38 | DigitalIn centreSensor; |
melse | 0:227158f56a11 | 39 | DigitalIn inLeftSensor; |
melse | 0:227158f56a11 | 40 | DigitalIn leftSensor; |
melse | 0:227158f56a11 | 41 | |
melse | 0:227158f56a11 | 42 | private: |
melse | 0:227158f56a11 | 43 | PwmOut motor1A; |
melse | 0:227158f56a11 | 44 | DigitalOut motor1B; |
melse | 0:227158f56a11 | 45 | DigitalOut motor1En; |
melse | 0:227158f56a11 | 46 | |
melse | 0:227158f56a11 | 47 | // motor2A or motor2B need to be PWM, but the freedom board doesn't support it at the moment... |
melse | 0:227158f56a11 | 48 | PwmOut motor2A; |
melse | 0:227158f56a11 | 49 | DigitalOut motor2B; |
melse | 0:227158f56a11 | 50 | DigitalOut motor2En; |
melse | 0:227158f56a11 | 51 | }; |