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
Committer:
sillevl
Date:
Mon Jun 01 14:53:39 2015 +0000
Revision:
9:0385d1bfc38b
Parent:
8:597ce8a7d34b
added Xbee support for start/stop

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sillevl 8:597ce8a7d34b 1 #ifndef XBEE_H
sillevl 8:597ce8a7d34b 2 #define XBEE_H
sillevl 8:597ce8a7d34b 3
sillevl 8:597ce8a7d34b 4 #include "mbed.h"
sillevl 8:597ce8a7d34b 5
sillevl 8:597ce8a7d34b 6 class Xbee{
sillevl 8:597ce8a7d34b 7
sillevl 8:597ce8a7d34b 8 public:
sillevl 8:597ce8a7d34b 9 Xbee(PinName tx, PinName rx);
sillevl 8:597ce8a7d34b 10 int running();
sillevl 8:597ce8a7d34b 11 int stopped();
sillevl 8:597ce8a7d34b 12 void setCode(int code);
sillevl 8:597ce8a7d34b 13 int hasCode();
sillevl 8:597ce8a7d34b 14
sillevl 8:597ce8a7d34b 15 protected:
sillevl 8:597ce8a7d34b 16 Serial* xbee;
sillevl 8:597ce8a7d34b 17 void received();
sillevl 8:597ce8a7d34b 18
sillevl 8:597ce8a7d34b 19 private:
sillevl 8:597ce8a7d34b 20 int run;
sillevl 8:597ce8a7d34b 21 int code;
sillevl 8:597ce8a7d34b 22
sillevl 8:597ce8a7d34b 23 int buffer_pos;
sillevl 8:597ce8a7d34b 24 char buffer[256];
sillevl 8:597ce8a7d34b 25
sillevl 8:597ce8a7d34b 26 void reset();
sillevl 8:597ce8a7d34b 27 DigitalOut* rst;
sillevl 8:597ce8a7d34b 28
sillevl 8:597ce8a7d34b 29 };
sillevl 8:597ce8a7d34b 30
sillevl 8:597ce8a7d34b 31
sillevl 8:597ce8a7d34b 32 #endif