Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of ELEC351_Group_T by
ALGORITHM.hpp
00001 /* 00002 This is the ALGORITHM class and it will be used tgo determine the move sequence the motors need to enact upon. 00003 */ 00004 00005 #ifndef ALGORITHM_HPP//Header Guards Prevents Multiple includes 00006 #define ALGORITHM_HPP 00007 00008 //Libraries and header includes 00009 #include "THREADS.hpp" 00010 #include "mbed.h" 00011 #include "rtos.h" 00012 #include "SERIAL.hpp" 00013 #include "COLOURS.hpp" 00014 00015 enum Colours//The posible colours of each point on the cube map 00016 { 00017 White,//Front 00018 Red,//Upper 00019 Orange,//Down 00020 Blue,//Left 00021 Green,//Right 00022 Yellow//Back 00023 }; 00024 static Colours CubeMap[6][3][3];//The colours of each section on the cube map 00025 00026 enum Moves//This is an enumeration of the different tpyes of moves which will be avalible 00027 { 00028 CL,AL, 00029 CF,AF, 00030 CR,AR, 00031 CB,AB, 00032 CU,AU, 00033 CD,AD 00034 00035 }; 00036 class ALGORITHM //This creates a class called Led 00037 { 00038 public: 00039 00040 ALGORITHM(); //Constructor 00041 ~ALGORITHM();//Destructor 00042 void ALGORITHM_INIT(); 00043 void Find_edges();//Sets the internal variable to the location of all the pieces and the positions of them 00044 void Find_Corners();//Finds the corners with the colour that is passed into them 00045 private: 00046 //Private member variables to prevent them being accessed externally 00047 //Data Pins 00048 int _State; 00049 //Pointers to the lists elements 00050 int _White_Pointer_Edge; 00051 int _Orange_Pointer_Edge; 00052 int _Blue_Pointer_Edge; 00053 int _Red_Pointer_Edge; 00054 int _Green_Pointer_Edge; 00055 int _Yellow_Pointer_Edge; 00056 00057 int _White_Pointer_Corner; 00058 int _Orange_Pointer_Corner; 00059 int _Blue_Pointer_Corner; 00060 int _Red_Pointer_Corner; 00061 int _Green_Pointer_Corner; 00062 int _Yellow_Pointer_Corner; 00063 //Lists with the positions of the colours 00064 int _White_List_Edge[4]; 00065 int _Orange_List_Edge[4]; 00066 int _Blue_List_Edge[4]; 00067 int _Red_List_Edge[4]; 00068 int _Green_List_Edge[4]; 00069 int _Yellow_List_Edge[4]; 00070 00071 int _White_List_Corner[4]; 00072 int _Orange_List_Corner[4]; 00073 int _Blue_List_Corner[4]; 00074 int _Red_List_Corner[4]; 00075 int _Green_List_Corner[4]; 00076 int _Yellow_List_Corner[4]; 00077 00078 00079 //Private member functions 00080 void _Find_edges_White();//Identify White edges 00081 void _Find_Corners_White();//Identify White edges 00082 void _Find_edges_Orange();//Identify White edges 00083 void _Find_Corners_Orange();//Identify White edges 00084 void _Find_edges_Blue();//Identify White edges 00085 void _Find_Corners_Blue();//Identify White edges 00086 void _Find_edges_Red();//Identify White edges 00087 void _Find_Corners_Red();//Identify White edges 00088 void _Find_edges_Green();//Identify White edges 00089 void _Find_Corners_Green();//Identify White edges 00090 void _Find_edges_Yellow();//Identify White edges 00091 void _Find_Corners_Yellow();//Identify White edges 00092 }; 00093 class SIDE //This creates a class called Led 00094 { 00095 public: 00096 00097 SIDE(); //Constructor 00098 ~SIDE();//Destructor 00099 int SIDE_type(); 00100 00101 void Set_Colours(int CP1,int CP2,int CP3,int CP4,int CP5,int CP6,int CP7,int CP8,int CP9); 00102 private: 00103 //Private member variables to prevent them being accessed externally 00104 00105 //Positions of the cubelets 00106 int _Cubelet_1_position; 00107 int _Cubelet_2_position; 00108 int _Cubelet_3_position; 00109 int _Cubelet_4_position; 00110 int _Cubelet_5_position; 00111 int _Cubelet_6_position; 00112 int _Cubelet_7_position; 00113 int _Cubelet_8_position; 00114 int _Cubelet_9_position; 00115 00116 int _Cubelet_1_colour; 00117 int _Cubelet_2_colour; 00118 int _Cubelet_3_colour; 00119 int _Cubelet_4_colour; 00120 int _Cubelet_5_colour; 00121 int _Cubelet_6_colour; 00122 int _Cubelet_7_colour; 00123 int _Cubelet_8_colour; 00124 int _Cubelet_9_colour; 00125 00126 }; 00127 00128 00129 #endif//ALGORITHM_HPP
Generated on Tue Jul 12 2022 22:52:51 by
