3rd year group project. Electronic and Electrical Engineering. Heriot-Watt University. This is the code for the mbed for the Automatic Little Object Organiser (ALOO).

Dependencies:   MCP23017 TCS3472_I2C WattBob_TextLCD mbed

Committer:
dreamselec
Date:
Sun Nov 29 01:05:42 2015 +0000
Revision:
24:02c61793f90b
Parent:
23:db91aaa43a9e
Child:
32:9a4046224b11
Both break-beam and servo test modes working.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dreamselec 6:98fe30430194 1 //
dreamselec 6:98fe30430194 2 // commander.h
dreamselec 6:98fe30430194 3 // Created by Chandan Siyag on 14/11/2015.
dreamselec 6:98fe30430194 4
dreamselec 2:7a55cb10259f 5 #include "globals.h"
dreamselec 2:7a55cb10259f 6
dreamselec 6:98fe30430194 7 #ifndef _commander_h_
dreamselec 6:98fe30430194 8 #define _commander_h_
dreamselec 2:7a55cb10259f 9
dreamselec 8:e1da2ae62885 10 const int kMaxCommandCount = 10;
dreamselec 23:db91aaa43a9e 11 enum CommandObjectRaw { InvalidObject = -1, MBED = 0, PC = 1, ColourSensor = 2, Servos = 3, Port = 4, BreakBeam = 5 };
dreamselec 24:02c61793f90b 12 extern std::string CommandObjectValue [6];
dreamselec 24:02c61793f90b 13 extern std::string CommandObjectCommandsValue [6][kMaxCommandCount];
dreamselec 8:e1da2ae62885 14
dreamselec 2:7a55cb10259f 15
dreamselec 24:02c61793f90b 16 class Commander {
dreamselec 24:02c61793f90b 17 public:
dreamselec 24:02c61793f90b 18 Commander();
dreamselec 24:02c61793f90b 19
dreamselec 24:02c61793f90b 20 CommandTypeRaw typeRaw;
dreamselec 24:02c61793f90b 21 char typeChar;
dreamselec 24:02c61793f90b 22 CommandObjectRaw objectRaw;
dreamselec 24:02c61793f90b 23 std::string object;
dreamselec 24:02c61793f90b 24 std::string command[kMaxCommandCount - 1];
dreamselec 24:02c61793f90b 25 std::string commandValue[kMaxCommandCount - 1];
dreamselec 24:02c61793f90b 26 int commandIndex[kMaxCommandCount -1];
dreamselec 14:cf2f255b5560 27 bool replyCommands;
dreamselec 24:02c61793f90b 28
dreamselec 24:02c61793f90b 29 void decodeCommand(CommandTypeRaw type);
dreamselec 24:02c61793f90b 30 std::string description();
dreamselec 24:02c61793f90b 31
dreamselec 24:02c61793f90b 32 virtual ~Commander();
dreamselec 24:02c61793f90b 33
dreamselec 24:02c61793f90b 34 private:
dreamselec 24:02c61793f90b 35 void readCommandObject();
dreamselec 24:02c61793f90b 36 bool readCommand(CommandObjectRaw objectRaw);
dreamselec 24:02c61793f90b 37 void executeCommand();
dreamselec 24:02c61793f90b 38 void resetVariables();
dreamselec 6:98fe30430194 39 };
dreamselec 2:7a55cb10259f 40
dreamselec 8:e1da2ae62885 41 #endif