Racing Robots Session

Dependencies:   m3pi mbed

Fork of racing_robots by Nico De Witte

robot_logic.h

Committer:
dwini
Date:
2015-02-23
Revision:
0:c0ae66a0ec7a
Child:
2:356bb8d99326

File content as of revision 0:c0ae66a0ec7a:

#include "mbed.h"
#include "m3pi.h"

#ifndef H_ROBOT_LOGIC
#define H_ROBOT_LOGIC

//typedef enum {
//    LED_1 = 0,
//    LED_2 = 1,
//    LED_3 = 2,
//    LED_4 = 3
//    //.....
//} LedIndex;

typedef enum {
    LED_ON = 0,
    LED_OFF = 1,
    LED_TOGGLE = 2
} LedState;


/*
 * Drive the robot forward or backward.
 *
 * @speed The speed percentage with which to drive forward or backward [-100, +100].
 */
void drive(int speed);

// speed between -100% en +100%
void turn(int turnspeed);

// Stop the robot
void stop();

void sensor_calibrate();

// Read the value from the line sensor
int line_sensor();

// PID drive control
void pid_init(int p, int i, int d);


// returns turnspeed
int pid_turn(int line_position);

// Show drive speed and sensor data
void showStats();

// Show text on display
void display(char* fmt, ...);

// Turn a led on or off
//void led(LedIndex i, LedState state);

// Wait for a number of milliseconds
void await(int milliseconds);

#endif