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 22 17:53:36 2015 +0000
Revision:
14:cf2f255b5560
Parent:
12:f485796016f8
Child:
23:db91aaa43a9e
Changed sorting algorithm for colour sensor next to top beam.
Added filled some commands rather than just printing.

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 8:e1da2ae62885 11 enum CommandObjectRaw { InvalidObject = -1, MBED = 0, PC = 1, ColourSensor = 2, Servos = 3, Port = 4 };
dreamselec 8:e1da2ae62885 12 extern std::string CommandObjectValue [5];
dreamselec 8:e1da2ae62885 13 extern std::string CommandObjectCommandsValue [5][kMaxCommandCount];
dreamselec 8:e1da2ae62885 14
dreamselec 2:7a55cb10259f 15
dreamselec 12:f485796016f8 16 class Commander {
dreamselec 12:f485796016f8 17 public:
dreamselec 12:f485796016f8 18 Commander();
dreamselec 12:f485796016f8 19
dreamselec 12:f485796016f8 20 CommandTypeRaw typeRaw;
dreamselec 12:f485796016f8 21 char typeChar;
dreamselec 12:f485796016f8 22 CommandObjectRaw objectRaw;
dreamselec 12:f485796016f8 23 std::string object;
dreamselec 12:f485796016f8 24 std::string command[kMaxCommandCount - 1];
dreamselec 12:f485796016f8 25 std::string commandValue[kMaxCommandCount - 1];
dreamselec 12:f485796016f8 26 int commandIndex[kMaxCommandCount -1];
dreamselec 14:cf2f255b5560 27 bool replyCommands;
dreamselec 12:f485796016f8 28
dreamselec 12:f485796016f8 29 void decodeCommand(CommandTypeRaw type);
dreamselec 12:f485796016f8 30 std::string description();
dreamselec 12:f485796016f8 31
dreamselec 12:f485796016f8 32 virtual ~Commander();
dreamselec 12:f485796016f8 33
dreamselec 12:f485796016f8 34 private:
dreamselec 12:f485796016f8 35 void readCommandObject();
dreamselec 12:f485796016f8 36 bool readCommand(CommandObjectRaw objectRaw);
dreamselec 12:f485796016f8 37 void executeCommand();
dreamselec 12:f485796016f8 38 void resetVariables();
dreamselec 6:98fe30430194 39 };
dreamselec 2:7a55cb10259f 40
dreamselec 8:e1da2ae62885 41 #endif