Library for the Seeed Studio Shield Bot
SeeedStudioShieldBot.h@1:5c40f2a5e1ac, 2013-07-15 (annotated)
- Committer:
- melse
- Date:
- Mon Jul 15 13:38:07 2013 +0000
- Revision:
- 1:5c40f2a5e1ac
- Parent:
- 0:227158f56a11
- Child:
- 2:118efce95f3c
Made the library more compatible with the m3pi lib
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 | 0:227158f56a11 | 9 | void left_motor(float speed); |
melse | 0:227158f56a11 | 10 | void right_motor(float speed); |
melse | 0:227158f56a11 | 11 | |
melse | 0:227158f56a11 | 12 | // Like the two above, but both at the same speed. |
melse | 0:227158f56a11 | 13 | // Negative of either will do the same job as the other (hopefully...) |
melse | 0:227158f56a11 | 14 | void forward(float speed); |
melse | 0:227158f56a11 | 15 | void backward(float speed); |
melse | 0:227158f56a11 | 16 | |
melse | 0:227158f56a11 | 17 | // This will rotate both of the motors in opposite directions, at the same speed |
melse | 0:227158f56a11 | 18 | void left(float speed); |
melse | 0:227158f56a11 | 19 | void right(float speed); |
melse | 0:227158f56a11 | 20 | |
melse | 0:227158f56a11 | 21 | void disable_motor_a(); |
melse | 0:227158f56a11 | 22 | void disable_motor_b(); |
melse | 0:227158f56a11 | 23 | |
melse | 0:227158f56a11 | 24 | void enable_motor_a(); |
melse | 0:227158f56a11 | 25 | void enable_motor_b(); |
melse | 0:227158f56a11 | 26 | |
melse | 0:227158f56a11 | 27 | void stopAll(); |
melse | 0:227158f56a11 | 28 | |
melse | 0:227158f56a11 | 29 | // Need to do something to do with detected line... |
melse | 0:227158f56a11 | 30 | |
melse | 1:5c40f2a5e1ac | 31 | float line_position(); |
melse | 0:227158f56a11 | 32 | |
melse | 0:227158f56a11 | 33 | DigitalIn rightSensor; |
melse | 0:227158f56a11 | 34 | DigitalIn inRightSensor; |
melse | 0:227158f56a11 | 35 | DigitalIn centreSensor; |
melse | 0:227158f56a11 | 36 | DigitalIn inLeftSensor; |
melse | 0:227158f56a11 | 37 | DigitalIn leftSensor; |
melse | 0:227158f56a11 | 38 | |
melse | 0:227158f56a11 | 39 | private: |
melse | 0:227158f56a11 | 40 | PwmOut motor1A; |
melse | 0:227158f56a11 | 41 | DigitalOut motor1B; |
melse | 0:227158f56a11 | 42 | DigitalOut motor1En; |
melse | 0:227158f56a11 | 43 | |
melse | 0:227158f56a11 | 44 | // motor2A or motor2B need to be PWM, but the freedom board doesn't support it at the moment... |
melse | 0:227158f56a11 | 45 | PwmOut motor2A; |
melse | 0:227158f56a11 | 46 | DigitalOut motor2B; |
melse | 0:227158f56a11 | 47 | DigitalOut motor2En; |
melse | 0:227158f56a11 | 48 | }; |