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:

  1. Controlling the LEDS
  2. Move forward and backward
  3. Turn
  4. Read the sensor values
  5. Use a PID controller

racing_robots.cpp

Committer:
sillevl
Date:
2015-06-01
Revision:
9:0385d1bfc38b
Parent:
8:597ce8a7d34b

File content as of revision 9:0385d1bfc38b:

#include "robot_logic.h"

// External functions called from our library
extern void init(void);
extern void loop(void);

/*
 * System initialization.
 * Also calls external init() function.
 */
void _init(void) {
    // DO our init here
    init(); // Students init
#ifdef XBBE
    if(!xbee.hasCode()){
        error("no unique code is set when using Xbee for start/stop");
    }
#endif
}

/*
 * Entry point.
 * Also calls external loop function.
 */
int main (void) {
    // Initialize system
    _init();

    while (true) {
        loop();     // Students loop
    }
}