![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
to compare with V6, do not change.
Dependencies: mbed
Brobot.h@0:01c109e18d49, 2017-05-26 (annotated)
- Committer:
- obrie829
- Date:
- Fri May 26 12:33:39 2017 +0000
- Revision:
- 0:01c109e18d49
RobotV5 in working order
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
obrie829 | 0:01c109e18d49 | 1 | /* |
obrie829 | 0:01c109e18d49 | 2 | * Brobot.h |
obrie829 | 0:01c109e18d49 | 3 | * |
obrie829 | 0:01c109e18d49 | 4 | */ |
obrie829 | 0:01c109e18d49 | 5 | |
obrie829 | 0:01c109e18d49 | 6 | #ifndef BROBOT_H_ |
obrie829 | 0:01c109e18d49 | 7 | #define BROBOT_H_ |
obrie829 | 0:01c109e18d49 | 8 | |
obrie829 | 0:01c109e18d49 | 9 | #include <cstdlib> |
obrie829 | 0:01c109e18d49 | 10 | #include <mbed.h> |
obrie829 | 0:01c109e18d49 | 11 | |
obrie829 | 0:01c109e18d49 | 12 | /** |
obrie829 | 0:01c109e18d49 | 13 | * This is a device driver class to drive the robot autonomously |
obrie829 | 0:01c109e18d49 | 14 | */ |
obrie829 | 0:01c109e18d49 | 15 | class Brobot |
obrie829 | 0:01c109e18d49 | 16 | { |
obrie829 | 0:01c109e18d49 | 17 | |
obrie829 | 0:01c109e18d49 | 18 | public: |
obrie829 | 0:01c109e18d49 | 19 | // constructors have same name as the class |
obrie829 | 0:01c109e18d49 | 20 | Brobot(PwmOut* left, PwmOut* right, int number); |
obrie829 | 0:01c109e18d49 | 21 | Brobot(); //empty constructor |
obrie829 | 0:01c109e18d49 | 22 | |
obrie829 | 0:01c109e18d49 | 23 | |
obrie829 | 0:01c109e18d49 | 24 | // void init(PwmOut* left, PwmOut* right, int number); |
obrie829 | 0:01c109e18d49 | 25 | void turnleft(); |
obrie829 | 0:01c109e18d49 | 26 | void turnright(); |
obrie829 | 0:01c109e18d49 | 27 | void forward(); |
obrie829 | 0:01c109e18d49 | 28 | void back(); |
obrie829 | 0:01c109e18d49 | 29 | void stop(); |
obrie829 | 0:01c109e18d49 | 30 | void slow(float ammount); // ammount is subtracted from current speeds |
obrie829 | 0:01c109e18d49 | 31 | void rotate(float ammount); // values from -0.5 to 0.5 |
obrie829 | 0:01c109e18d49 | 32 | |
obrie829 | 0:01c109e18d49 | 33 | private: |
obrie829 | 0:01c109e18d49 | 34 | PwmOut* pwmL; |
obrie829 | 0:01c109e18d49 | 35 | PwmOut* pwmR; |
obrie829 | 0:01c109e18d49 | 36 | int number; |
obrie829 | 0:01c109e18d49 | 37 | }; |
obrie829 | 0:01c109e18d49 | 38 | |
obrie829 | 0:01c109e18d49 | 39 | #endif /* BROBOT_H_ */ |