Sophia, an autonomous robot based on Tamiya kits
Sophia.h@0:db79273ace80, 2013-05-09 (annotated)
- Committer:
- cylax
- Date:
- Thu May 09 02:45:44 2013 +0000
- Revision:
- 0:db79273ace80
- Child:
- 1:575431135236
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
cylax | 0:db79273ace80 | 1 | #ifndef MBED_SOPHIA_H |
cylax | 0:db79273ace80 | 2 | #define MBED_SOPHIA_H |
cylax | 0:db79273ace80 | 3 | |
cylax | 0:db79273ace80 | 4 | #include "mbed.h" |
cylax | 0:db79273ace80 | 5 | #define FWD 1 |
cylax | 0:db79273ace80 | 6 | #define REV 0 |
cylax | 0:db79273ace80 | 7 | #define LEFT 0 |
cylax | 0:db79273ace80 | 8 | #define RIGHT 1 |
cylax | 0:db79273ace80 | 9 | |
cylax | 0:db79273ace80 | 10 | /** Interface to control a Sophia robot |
cylax | 0:db79273ace80 | 11 | * |
cylax | 0:db79273ace80 | 12 | */ |
cylax | 0:db79273ace80 | 13 | class Sophia { |
cylax | 0:db79273ace80 | 14 | public: |
cylax | 0:db79273ace80 | 15 | /** Set the speed of the motor |
cylax | 0:db79273ace80 | 16 | * |
cylax | 0:db79273ace80 | 17 | * @param speed The speed of the motor as a normalised value between -1.0 and 1.0 |
cylax | 0:db79273ace80 | 18 | * @param direction The desired direction to move the robot, FWD, REV, LEFT and RIGHT. |
cylax | 0:db79273ace80 | 19 | */ |
cylax | 0:db79273ace80 | 20 | void move(float speed, int direction); // direction = 0:left, 1:right |
cylax | 0:db79273ace80 | 21 | void turn(float speed, int direction); // direction = 0:left, 1:right |
cylax | 0:db79273ace80 | 22 | void spin(float speed, int direction); // direction = 0:left, 1:right |
cylax | 0:db79273ace80 | 23 | }; |
cylax | 0:db79273ace80 | 24 | |
cylax | 0:db79273ace80 | 25 | #endif |