Racing Robots Session
Dependencies: MbedJSONValue m3pi
This is the library for the Racing Robots session. It supports the M3PI robot of Polulu.
It is based on the "Arduino" principle of the init and loop function.
Just add a main.cpp file which contains:
Racing Robots main file
#include "robot_logic.h" void init() { //put your initialization logic here } void loop() { //put your robot control logic here }
Features include:
- Controlling the LEDS
- Move forward and backward
- Turn
- Read the sensor values
- Use a PID controller
Revision 1:43c91152e9ce, committed 2015-02-23
- Comitter:
- dwini
- Date:
- Mon Feb 23 12:48:22 2015 +0000
- Parent:
- 0:c0ae66a0ec7a
- Child:
- 2:356bb8d99326
- Commit message:
- Cleanup of racing_robots.
Changed in this revision
racing_robots.cpp | Show annotated file Show diff for this revision Revisions of this file |
racing_robots.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/racing_robots.cpp Mon Feb 23 12:24:31 2015 +0000 +++ b/racing_robots.cpp Mon Feb 23 12:48:22 2015 +0000 @@ -1,27 +1,28 @@ #include "racing_robots.h" -DigitalOut myled(LED1); - +// External functions called from our library +extern void init(void); extern void loop(void); -extern void init(void); - +/* + * System initialization. + * Also calls external init() function. + */ void _init(void) { // DO our init here init(); // Students init } -void racing_robots(void) { +/* + * Entry point. + * Also calls external loop function. + */ +int main (void) { // Initialize system _init(); while (true) { loop(); // Students loop } -} - - -int main (void) { - racing_robots(); } \ No newline at end of file
--- a/racing_robots.h Mon Feb 23 12:24:31 2015 +0000 +++ b/racing_robots.h Mon Feb 23 12:48:22 2015 +0000 @@ -5,6 +5,4 @@ #ifndef H_RACING_ROBOTS #define H_RACING_ROBOTS -void racing_robots(void); - #endif \ No newline at end of file