David Bruce 15597305

Dependencies:   mbed N5110 GT511C3

Committer:
davidbruce
Date:
Mon May 04 15:05:09 2020 +0000
Revision:
3:938a2d4ae661
Parent:
2:61e0f5bec6ff
IOTProjectCodeDavidBruce15597305

Who changed what in which revision?

UserRevisionLine numberNew contents of line
beanmachine44 0:4bbfc068d864 1 #include "mbed.h"
beanmachine44 0:4bbfc068d864 2 #include "GT511C3.hpp"
davidbruce 3:938a2d4ae661 3 #include "N5110.h"
davidbruce 3:938a2d4ae661 4 N5110 N5110(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
davidbruce 3:938a2d4ae661 5 Serial serial(USBTX, USBRX);
beanmachine44 0:4bbfc068d864 6 DigitalOut myled(LED1);
davidbruce 3:938a2d4ae661 7 GT511C3 GT511C3(PTC17,PTC16);
davidbruce 3:938a2d4ae661 8
davidbruce 3:938a2d4ae661 9 void Clock();
davidbruce 3:938a2d4ae661 10 void EnrollFP1();
davidbruce 3:938a2d4ae661 11 void EnrollFP2();
davidbruce 3:938a2d4ae661 12 void EnrollFP3();
davidbruce 3:938a2d4ae661 13 void EnrollFP4();
davidbruce 3:938a2d4ae661 14 void EnrollFP5();
davidbruce 3:938a2d4ae661 15 void EnrollFP6();
davidbruce 3:938a2d4ae661 16 void EnrollFP7();
davidbruce 3:938a2d4ae661 17 void EnrollFP8();
davidbruce 3:938a2d4ae661 18 void EnrollFP9();
davidbruce 3:938a2d4ae661 19 void IDSelect();
davidbruce 3:938a2d4ae661 20 int clkcheck1;
davidbruce 3:938a2d4ae661 21 int clkcheck2;
davidbruce 3:938a2d4ae661 22 int clkcheck3;
davidbruce 3:938a2d4ae661 23 int clkcheck4;
davidbruce 3:938a2d4ae661 24 int clkcheck5;
davidbruce 3:938a2d4ae661 25 int clkcheck6;
davidbruce 3:938a2d4ae661 26 int clkcheck7;
davidbruce 3:938a2d4ae661 27 int clkcheck8;
davidbruce 3:938a2d4ae661 28 int clkcheck9;
davidbruce 3:938a2d4ae661 29 int UserIDDetect;
davidbruce 3:938a2d4ae661 30 int UserID;
davidbruce 3:938a2d4ae661 31 int select;
davidbruce 3:938a2d4ae661 32
beanmachine44 0:4bbfc068d864 33 int progress(int status,char *msg)
beanmachine44 0:4bbfc068d864 34 {
davidbruce 3:938a2d4ae661 35 serial.printf("%s",msg);
beanmachine44 0:4bbfc068d864 36 return 0;
beanmachine44 0:4bbfc068d864 37 }
davidbruce 3:938a2d4ae661 38
davidbruce 3:938a2d4ae661 39 int main()
davidbruce 3:938a2d4ae661 40 {
davidbruce 3:938a2d4ae661 41 clkcheck1 = 0;
davidbruce 3:938a2d4ae661 42 clkcheck2= 0;
davidbruce 3:938a2d4ae661 43 clkcheck3= 0;
davidbruce 3:938a2d4ae661 44 clkcheck4= 0;
davidbruce 3:938a2d4ae661 45 clkcheck5= 0;
davidbruce 3:938a2d4ae661 46 clkcheck6= 0;
davidbruce 3:938a2d4ae661 47 clkcheck7= 0;
davidbruce 3:938a2d4ae661 48 clkcheck8= 0;
davidbruce 3:938a2d4ae661 49 clkcheck9= 0;
davidbruce 3:938a2d4ae661 50 serial.format(8,Serial::None,1);
davidbruce 3:938a2d4ae661 51 serial.baud(9600);
davidbruce 3:938a2d4ae661 52 GT511C3.Open(); //Initialise the Fingerprint Sensor
davidbruce 3:938a2d4ae661 53 N5110.init(); //Initialise the screen
davidbruce 3:938a2d4ae661 54 N5110.setContrast(0);
davidbruce 3:938a2d4ae661 55 N5110.normalMode();
davidbruce 3:938a2d4ae661 56 N5110.setBrightness(0); //Max Brightness
davidbruce 3:938a2d4ae661 57 N5110.printString("Biometric",1,1);
davidbruce 3:938a2d4ae661 58 N5110.printString("Smart",1,2);
davidbruce 3:938a2d4ae661 59 N5110.printString("Attendance",1,3);
davidbruce 3:938a2d4ae661 60 N5110.printString("System",1,4);
davidbruce 3:938a2d4ae661 61 N5110.refresh();
davidbruce 3:938a2d4ae661 62 wait(4);
davidbruce 3:938a2d4ae661 63 N5110.clear();
davidbruce 3:938a2d4ae661 64 N5110.printString("By",10,1);
davidbruce 3:938a2d4ae661 65 N5110.printString("David Bruce",1,2);
davidbruce 3:938a2d4ae661 66 N5110.printString("Loading",1,4);
davidbruce 3:938a2d4ae661 67 N5110.refresh();
davidbruce 3:938a2d4ae661 68 wait(0.25);
davidbruce 3:938a2d4ae661 69 N5110.printString("Loading.",1,4);
davidbruce 3:938a2d4ae661 70 N5110.refresh();
davidbruce 3:938a2d4ae661 71 wait(0.25);
davidbruce 3:938a2d4ae661 72 N5110.printString("Loading..",1,4);
davidbruce 3:938a2d4ae661 73 N5110.refresh();
davidbruce 3:938a2d4ae661 74 wait(0.25);
davidbruce 3:938a2d4ae661 75 N5110.printString("Loading...",1,4);
davidbruce 3:938a2d4ae661 76 N5110.refresh();
davidbruce 3:938a2d4ae661 77 wait(0.25);
davidbruce 3:938a2d4ae661 78 N5110.clear();
davidbruce 3:938a2d4ae661 79 N5110.printString("By",10,1);
davidbruce 3:938a2d4ae661 80 N5110.printString("David Bruce",1,2);
davidbruce 3:938a2d4ae661 81 N5110.printString("Loading.",1,4);
davidbruce 3:938a2d4ae661 82 N5110.refresh();
davidbruce 3:938a2d4ae661 83 wait(0.25);
davidbruce 3:938a2d4ae661 84 N5110.printString("Loading..",1,4);
davidbruce 3:938a2d4ae661 85 N5110.refresh();
davidbruce 3:938a2d4ae661 86 wait(0.25);
davidbruce 3:938a2d4ae661 87 N5110.clear();
davidbruce 3:938a2d4ae661 88 N5110.printString("Press'a' on",1,2); //works with any key, but a is not linked to anything later so stop confusion
davidbruce 3:938a2d4ae661 89 N5110.printString("the keyboard",1,3);
davidbruce 3:938a2d4ae661 90 N5110.printString("to continue",1,4);
davidbruce 3:938a2d4ae661 91 N5110.refresh();
davidbruce 3:938a2d4ae661 92 wait(0.25);
davidbruce 3:938a2d4ae661 93 N5110.clear();
davidbruce 3:938a2d4ae661 94 IDSelect();
beanmachine44 0:4bbfc068d864 95 }
davidbruce 3:938a2d4ae661 96
davidbruce 3:938a2d4ae661 97 void IDSelect(){
davidbruce 3:938a2d4ae661 98 while(1){
davidbruce 3:938a2d4ae661 99 char c = serial.getc();
davidbruce 3:938a2d4ae661 100 N5110.clear();
davidbruce 3:938a2d4ae661 101 N5110.printString("Select ID:",1,0);
davidbruce 3:938a2d4ae661 102 N5110.printString("To do so",1,1);
davidbruce 3:938a2d4ae661 103 N5110.printString("select a no.",1,2);
davidbruce 3:938a2d4ae661 104 N5110.printString("from 1-9 on",1,3);
davidbruce 3:938a2d4ae661 105 N5110.printString("your keyboard. Use",1,4);
davidbruce 3:938a2d4ae661 106 N5110.printString("'e' to confirm",1,5);
davidbruce 3:938a2d4ae661 107 N5110.refresh();
davidbruce 3:938a2d4ae661 108 serial.printf("%s",select);
beanmachine44 2:61e0f5bec6ff 109
davidbruce 3:938a2d4ae661 110 if(c == '1') {
davidbruce 3:938a2d4ae661 111 N5110.clear();
davidbruce 3:938a2d4ae661 112 N5110.printString("Select ID:",1,0);
davidbruce 3:938a2d4ae661 113 N5110.printString("..... 1 .....",1,1);
davidbruce 3:938a2d4ae661 114 N5110.printString("Press the letter",1,4);
davidbruce 3:938a2d4ae661 115 N5110.printString("'e' to confirm",1,5);
davidbruce 3:938a2d4ae661 116 N5110.refresh();
davidbruce 3:938a2d4ae661 117 select = 1;
davidbruce 3:938a2d4ae661 118 }
davidbruce 3:938a2d4ae661 119
davidbruce 3:938a2d4ae661 120 if(c == '2') {
davidbruce 3:938a2d4ae661 121 N5110.clear();
davidbruce 3:938a2d4ae661 122 N5110.printString("Select ID:",1,0);
davidbruce 3:938a2d4ae661 123 N5110.printString("..... 2 .....",1,1);
davidbruce 3:938a2d4ae661 124 N5110.printString("Press the letter",1,4);
davidbruce 3:938a2d4ae661 125 N5110.printString("'e' to confirm",1,5);
davidbruce 3:938a2d4ae661 126 N5110.refresh();
davidbruce 3:938a2d4ae661 127 select = 2;
davidbruce 3:938a2d4ae661 128 }
davidbruce 3:938a2d4ae661 129
davidbruce 3:938a2d4ae661 130 if(c == '3') {
davidbruce 3:938a2d4ae661 131 N5110.clear();
davidbruce 3:938a2d4ae661 132 N5110.printString("Select ID:",1,0);
davidbruce 3:938a2d4ae661 133 N5110.printString("..... 3 .....",1,1);
davidbruce 3:938a2d4ae661 134 N5110.printString("Press the letter",1,4);
davidbruce 3:938a2d4ae661 135 N5110.printString("'e' to confirm",1,5);
davidbruce 3:938a2d4ae661 136 N5110.refresh();
davidbruce 3:938a2d4ae661 137 select = 3;
davidbruce 3:938a2d4ae661 138 }
davidbruce 3:938a2d4ae661 139
davidbruce 3:938a2d4ae661 140 if(c == '4') {
davidbruce 3:938a2d4ae661 141 N5110.clear();
davidbruce 3:938a2d4ae661 142 N5110.printString("Select ID:",1,0);
davidbruce 3:938a2d4ae661 143 N5110.printString("..... 4 .....",1,1);
davidbruce 3:938a2d4ae661 144 N5110.printString("Press the letter",1,4);
davidbruce 3:938a2d4ae661 145 N5110.printString("'e' to confirm",1,5);
davidbruce 3:938a2d4ae661 146 N5110.refresh();
davidbruce 3:938a2d4ae661 147 select = 4;
davidbruce 3:938a2d4ae661 148 }
davidbruce 3:938a2d4ae661 149
davidbruce 3:938a2d4ae661 150 if(c == '5') {
davidbruce 3:938a2d4ae661 151 N5110.clear();
davidbruce 3:938a2d4ae661 152 N5110.printString("Select ID:",1,0);
davidbruce 3:938a2d4ae661 153 N5110.printString("..... 5 .....",1,1);
davidbruce 3:938a2d4ae661 154 N5110.printString("Press the letter",1,4);
davidbruce 3:938a2d4ae661 155 N5110.printString("'e' to confirm",1,5);
davidbruce 3:938a2d4ae661 156 N5110.refresh();
davidbruce 3:938a2d4ae661 157 select = 5;
davidbruce 3:938a2d4ae661 158 }
davidbruce 3:938a2d4ae661 159
davidbruce 3:938a2d4ae661 160 if(c == '6') {
davidbruce 3:938a2d4ae661 161 N5110.clear();
davidbruce 3:938a2d4ae661 162 N5110.printString("Select ID:",1,0);
davidbruce 3:938a2d4ae661 163 N5110.printString("..... 6 .....",1,1);
davidbruce 3:938a2d4ae661 164 N5110.printString("Press the letter",1,4);
davidbruce 3:938a2d4ae661 165 N5110.printString("'e' to confirm",1,5);
davidbruce 3:938a2d4ae661 166 N5110.refresh();
davidbruce 3:938a2d4ae661 167 select = 6;
davidbruce 3:938a2d4ae661 168 }
davidbruce 3:938a2d4ae661 169
davidbruce 3:938a2d4ae661 170 if(c == '7') {
davidbruce 3:938a2d4ae661 171 N5110.clear();
davidbruce 3:938a2d4ae661 172 N5110.printString("Select ID:",1,0);
davidbruce 3:938a2d4ae661 173 N5110.printString("..... 7 .....",1,1);
davidbruce 3:938a2d4ae661 174 N5110.printString("Press the letter",1,4);
davidbruce 3:938a2d4ae661 175 N5110.printString("'e' to confirm",1,5);
davidbruce 3:938a2d4ae661 176 N5110.refresh();
davidbruce 3:938a2d4ae661 177 select = 7;
davidbruce 3:938a2d4ae661 178 }
davidbruce 3:938a2d4ae661 179
davidbruce 3:938a2d4ae661 180 if(c == '8') {
davidbruce 3:938a2d4ae661 181 N5110.clear();
davidbruce 3:938a2d4ae661 182 N5110.printString("Select ID:",1,0);
davidbruce 3:938a2d4ae661 183 N5110.printString("..... 8 .....",1,1);
davidbruce 3:938a2d4ae661 184 N5110.printString("Press the letter",1,4);
davidbruce 3:938a2d4ae661 185 N5110.printString("'e' to confirm",1,5);
davidbruce 3:938a2d4ae661 186 N5110.refresh();
davidbruce 3:938a2d4ae661 187 select = 8;
davidbruce 3:938a2d4ae661 188 }
davidbruce 3:938a2d4ae661 189
davidbruce 3:938a2d4ae661 190 if(c == '9') {
davidbruce 3:938a2d4ae661 191 N5110.clear();
davidbruce 3:938a2d4ae661 192 N5110.printString("Select ID:",1,0);
davidbruce 3:938a2d4ae661 193 N5110.printString("..... 9 .....",1,1);
davidbruce 3:938a2d4ae661 194 N5110.printString("Press the letter",1,4);
davidbruce 3:938a2d4ae661 195 N5110.printString("'e' to confirm",1,5);
davidbruce 3:938a2d4ae661 196 N5110.refresh();
davidbruce 3:938a2d4ae661 197 select = 9;
davidbruce 3:938a2d4ae661 198 }
davidbruce 3:938a2d4ae661 199
davidbruce 3:938a2d4ae661 200 if((select == 1) && (c == 'e')) {
davidbruce 3:938a2d4ae661 201 N5110.clear();
davidbruce 3:938a2d4ae661 202 N5110.printString("ID Selected:",1,0);
davidbruce 3:938a2d4ae661 203 N5110.printString("..... 1.....",1,1);
davidbruce 3:938a2d4ae661 204 N5110.refresh();
davidbruce 3:938a2d4ae661 205 wait(4);
davidbruce 3:938a2d4ae661 206 EnrollFP1();
davidbruce 3:938a2d4ae661 207 }
davidbruce 3:938a2d4ae661 208
davidbruce 3:938a2d4ae661 209 if((select == 2) && (c == 'e')) {
davidbruce 3:938a2d4ae661 210 N5110.clear();
davidbruce 3:938a2d4ae661 211 N5110.printString("ID Selected:",1,0);
davidbruce 3:938a2d4ae661 212 N5110.printString("..... 2 .....",1,1);
davidbruce 3:938a2d4ae661 213 N5110.refresh();
davidbruce 3:938a2d4ae661 214 wait(4);
davidbruce 3:938a2d4ae661 215 EnrollFP2();
davidbruce 3:938a2d4ae661 216 }
davidbruce 3:938a2d4ae661 217
davidbruce 3:938a2d4ae661 218 if((select == 3) && (c == 'e')) {
davidbruce 3:938a2d4ae661 219 N5110.clear();
davidbruce 3:938a2d4ae661 220 N5110.printString("ID Selected:",1,0);
davidbruce 3:938a2d4ae661 221 N5110.printString("..... 3 .....",1,1);
davidbruce 3:938a2d4ae661 222 N5110.refresh();
davidbruce 3:938a2d4ae661 223 wait(4);
davidbruce 3:938a2d4ae661 224 EnrollFP3();
davidbruce 3:938a2d4ae661 225 }
davidbruce 3:938a2d4ae661 226
davidbruce 3:938a2d4ae661 227 if((select == 4) && (c == 'e')) {
davidbruce 3:938a2d4ae661 228 N5110.clear();
davidbruce 3:938a2d4ae661 229 N5110.printString("ID Selected:",1,0);
davidbruce 3:938a2d4ae661 230 N5110.printString("..... 4 .....",1,1);
davidbruce 3:938a2d4ae661 231 N5110.refresh();
davidbruce 3:938a2d4ae661 232 wait(4);
davidbruce 3:938a2d4ae661 233 EnrollFP4();
davidbruce 3:938a2d4ae661 234 }
davidbruce 3:938a2d4ae661 235
davidbruce 3:938a2d4ae661 236 if((select == 5) && (c == 'e')) {
davidbruce 3:938a2d4ae661 237 N5110.clear();
davidbruce 3:938a2d4ae661 238 N5110.printString("ID Selected:",1,0);
davidbruce 3:938a2d4ae661 239 N5110.printString("..... 5 .....",1,1);
davidbruce 3:938a2d4ae661 240 N5110.refresh();
davidbruce 3:938a2d4ae661 241 wait(4);
davidbruce 3:938a2d4ae661 242 EnrollFP5();
davidbruce 3:938a2d4ae661 243 }
davidbruce 3:938a2d4ae661 244
davidbruce 3:938a2d4ae661 245 if((select == 6) && (c == 'e')) {
davidbruce 3:938a2d4ae661 246 N5110.clear();
davidbruce 3:938a2d4ae661 247 N5110.printString("ID Selected:",1,0);
davidbruce 3:938a2d4ae661 248 N5110.printString("..... 6 .....",1,1);
davidbruce 3:938a2d4ae661 249 N5110.refresh();
davidbruce 3:938a2d4ae661 250 wait(4);
davidbruce 3:938a2d4ae661 251 EnrollFP6();
davidbruce 3:938a2d4ae661 252 }
davidbruce 3:938a2d4ae661 253
davidbruce 3:938a2d4ae661 254 if((select == 7) && (c == 'e')) {
davidbruce 3:938a2d4ae661 255 N5110.clear();
davidbruce 3:938a2d4ae661 256 N5110.printString("ID Selected:",1,0);
davidbruce 3:938a2d4ae661 257 N5110.printString("..... 7 .....",1,1);
davidbruce 3:938a2d4ae661 258 N5110.refresh();
davidbruce 3:938a2d4ae661 259 wait(4);
davidbruce 3:938a2d4ae661 260 EnrollFP7();
davidbruce 3:938a2d4ae661 261 }
davidbruce 3:938a2d4ae661 262
davidbruce 3:938a2d4ae661 263 if((select == 8) && (c == 'e')) {
davidbruce 3:938a2d4ae661 264 N5110.clear();
davidbruce 3:938a2d4ae661 265 N5110.printString("ID Selected:",1,0);
davidbruce 3:938a2d4ae661 266 N5110.printString("..... 8 .....",1,1);
davidbruce 3:938a2d4ae661 267 N5110.refresh();
davidbruce 3:938a2d4ae661 268 wait(4);
davidbruce 3:938a2d4ae661 269 EnrollFP8();
davidbruce 3:938a2d4ae661 270 }
davidbruce 3:938a2d4ae661 271
davidbruce 3:938a2d4ae661 272 if((select == 9) && (c == 'e')) {
davidbruce 3:938a2d4ae661 273 N5110.clear();
davidbruce 3:938a2d4ae661 274 N5110.printString("ID Selected:",1,0);
davidbruce 3:938a2d4ae661 275 N5110.printString("..... 9 .....",1,1);
davidbruce 3:938a2d4ae661 276 N5110.refresh();
davidbruce 3:938a2d4ae661 277 wait(4);
davidbruce 3:938a2d4ae661 278 EnrollFP9();
davidbruce 3:938a2d4ae661 279 }
davidbruce 3:938a2d4ae661 280 }
davidbruce 3:938a2d4ae661 281 }
davidbruce 3:938a2d4ae661 282
davidbruce 3:938a2d4ae661 283 void EnrollFP1(){
davidbruce 3:938a2d4ae661 284
davidbruce 3:938a2d4ae661 285 if(1){
davidbruce 3:938a2d4ae661 286 int UserID = 1; // Need to get this value from keyboard
davidbruce 3:938a2d4ae661 287 if(GT511C3.CheckEnrolled(UserID) == 0) { //If the User has previously been enrolled
davidbruce 3:938a2d4ae661 288 if(GT511C3.DeleteID(UserID) == 0){};//Delete User ID
davidbruce 3:938a2d4ae661 289 }
davidbruce 3:938a2d4ae661 290
davidbruce 3:938a2d4ae661 291 N5110.clear();
davidbruce 3:938a2d4ae661 292 N5110.printString("Place your",1,0);
davidbruce 3:938a2d4ae661 293 N5110.printString("finger on the",1,1);
davidbruce 3:938a2d4ae661 294 N5110.printString("sensor and",1,2);
davidbruce 3:938a2d4ae661 295 N5110.printString("remove it. Do",1,3);
davidbruce 3:938a2d4ae661 296 N5110.printString("until it is",1,4);
davidbruce 3:938a2d4ae661 297 N5110.printString("enrolled",1,5); //Instructions
davidbruce 3:938a2d4ae661 298 N5110.refresh();
davidbruce 3:938a2d4ae661 299
davidbruce 3:938a2d4ae661 300 GT511C3.Enroll(UserID,progress); //Enroll User with UserID of 1
davidbruce 3:938a2d4ae661 301
davidbruce 3:938a2d4ae661 302 if(GT511C3.CheckEnrolled(UserID) == 0) {
davidbruce 3:938a2d4ae661 303 N5110.clear();
davidbruce 3:938a2d4ae661 304 N5110.printString("Successfully",1,1);
davidbruce 3:938a2d4ae661 305 N5110.printString("Enrolled",1,2);
davidbruce 3:938a2d4ae661 306 N5110.refresh();
davidbruce 3:938a2d4ae661 307 wait(2); //If UserID is enrolled, print "Successfully Enrolled" on N5110 screen
davidbruce 3:938a2d4ae661 308
davidbruce 3:938a2d4ae661 309 GT511C3.CmosLed(1);
davidbruce 3:938a2d4ae661 310 Clock(); //Run Clock() This is seperate due to it being triggered in two places in the "register once, rebootable" version.
davidbruce 3:938a2d4ae661 311 }
davidbruce 3:938a2d4ae661 312 }
davidbruce 3:938a2d4ae661 313 }
davidbruce 3:938a2d4ae661 314
davidbruce 3:938a2d4ae661 315 void EnrollFP2(){
davidbruce 3:938a2d4ae661 316
davidbruce 3:938a2d4ae661 317 if(1){
davidbruce 3:938a2d4ae661 318 int UserID = 2;// Need to get this value from keyboard
davidbruce 3:938a2d4ae661 319 if(GT511C3.CheckEnrolled(UserID) == 0) { //If the User has previously been enrolled
davidbruce 3:938a2d4ae661 320 if(GT511C3.DeleteID(UserID) == 0){};//Delete User ID
davidbruce 3:938a2d4ae661 321 }
davidbruce 3:938a2d4ae661 322
davidbruce 3:938a2d4ae661 323 N5110.clear();
davidbruce 3:938a2d4ae661 324 N5110.printString("Place your",1,0);
davidbruce 3:938a2d4ae661 325 N5110.printString("finger on the",1,1);
davidbruce 3:938a2d4ae661 326 N5110.printString("sensor and",1,2);
davidbruce 3:938a2d4ae661 327 N5110.printString("remove it. Do",1,3);
davidbruce 3:938a2d4ae661 328 N5110.printString("until it is",1,4);
davidbruce 3:938a2d4ae661 329 N5110.printString("enrolled",1,5); //Instructions
davidbruce 3:938a2d4ae661 330 N5110.refresh();
davidbruce 3:938a2d4ae661 331
davidbruce 3:938a2d4ae661 332 GT511C3.Enroll(UserID,progress); //Enroll User with UserID of 1
davidbruce 3:938a2d4ae661 333
davidbruce 3:938a2d4ae661 334 if(GT511C3.CheckEnrolled(UserID) == 0) {
davidbruce 3:938a2d4ae661 335 N5110.clear();
davidbruce 3:938a2d4ae661 336 N5110.printString("Successfully",1,1);
davidbruce 3:938a2d4ae661 337 N5110.printString("Enrolled",1,2);
davidbruce 3:938a2d4ae661 338 N5110.refresh();
davidbruce 3:938a2d4ae661 339 wait(2); //If UserID is enrolled, print "Successfully Enrolled" on N5110 screen
davidbruce 3:938a2d4ae661 340
davidbruce 3:938a2d4ae661 341 GT511C3.CmosLed(1);
davidbruce 3:938a2d4ae661 342 Clock(); //Run Clock() This is seperate due to it being triggered in two places in the "register once, rebootable" version.
davidbruce 3:938a2d4ae661 343 }
davidbruce 3:938a2d4ae661 344 }
davidbruce 3:938a2d4ae661 345 }
davidbruce 3:938a2d4ae661 346
davidbruce 3:938a2d4ae661 347 void EnrollFP3(){
davidbruce 3:938a2d4ae661 348
davidbruce 3:938a2d4ae661 349 if(1){
davidbruce 3:938a2d4ae661 350 int UserID = 3; // Need to get this value from keyboard
davidbruce 3:938a2d4ae661 351 if(GT511C3.CheckEnrolled(UserID) == 0) { //If the User has previously been enrolled
davidbruce 3:938a2d4ae661 352 if(GT511C3.DeleteID(UserID) == 0){};//Delete User ID
davidbruce 3:938a2d4ae661 353 }
davidbruce 3:938a2d4ae661 354
davidbruce 3:938a2d4ae661 355 N5110.clear();
davidbruce 3:938a2d4ae661 356 N5110.printString("Place your",1,0);
davidbruce 3:938a2d4ae661 357 N5110.printString("finger on the",1,1);
davidbruce 3:938a2d4ae661 358 N5110.printString("sensor and",1,2);
davidbruce 3:938a2d4ae661 359 N5110.printString("remove it. Do",1,3);
davidbruce 3:938a2d4ae661 360 N5110.printString("until it is",1,4);
davidbruce 3:938a2d4ae661 361 N5110.printString("enrolled",1,5); //Instructions
davidbruce 3:938a2d4ae661 362 N5110.refresh();
davidbruce 3:938a2d4ae661 363
davidbruce 3:938a2d4ae661 364 GT511C3.Enroll(UserID,progress); //Enroll User with UserID of 1
davidbruce 3:938a2d4ae661 365
davidbruce 3:938a2d4ae661 366 if(GT511C3.CheckEnrolled(UserID) == 0) {
davidbruce 3:938a2d4ae661 367 N5110.clear();
davidbruce 3:938a2d4ae661 368 N5110.printString("Successfully",1,1);
davidbruce 3:938a2d4ae661 369 N5110.printString("Enrolled",1,2);
davidbruce 3:938a2d4ae661 370 N5110.refresh();
davidbruce 3:938a2d4ae661 371 wait(2); //If UserID is enrolled, print "Successfully Enrolled" on N5110 screen
davidbruce 3:938a2d4ae661 372
davidbruce 3:938a2d4ae661 373 GT511C3.CmosLed(1);
davidbruce 3:938a2d4ae661 374 Clock(); //Run Clock() This is seperate due to it being triggered in two places in the "register once, rebootable" version.
davidbruce 3:938a2d4ae661 375 }
davidbruce 3:938a2d4ae661 376 }
davidbruce 3:938a2d4ae661 377 }
davidbruce 3:938a2d4ae661 378
davidbruce 3:938a2d4ae661 379 void EnrollFP4(){
davidbruce 3:938a2d4ae661 380
davidbruce 3:938a2d4ae661 381 if(1){
davidbruce 3:938a2d4ae661 382 int UserID = 4; // Need to get this value from keyboard
davidbruce 3:938a2d4ae661 383 if(GT511C3.CheckEnrolled(UserID) == 0) { //If the User has previously been enrolled
davidbruce 3:938a2d4ae661 384 if(GT511C3.DeleteID(UserID) == 0){};//Delete User ID
davidbruce 3:938a2d4ae661 385 }
davidbruce 3:938a2d4ae661 386
davidbruce 3:938a2d4ae661 387 N5110.clear();
davidbruce 3:938a2d4ae661 388 N5110.printString("Place your",1,0);
davidbruce 3:938a2d4ae661 389 N5110.printString("finger on the",1,1);
davidbruce 3:938a2d4ae661 390 N5110.printString("sensor and",1,2);
davidbruce 3:938a2d4ae661 391 N5110.printString("remove it. Do",1,3);
davidbruce 3:938a2d4ae661 392 N5110.printString("until it is",1,4);
davidbruce 3:938a2d4ae661 393 N5110.printString("enrolled",1,5); //Instructions
davidbruce 3:938a2d4ae661 394 N5110.refresh();
davidbruce 3:938a2d4ae661 395
davidbruce 3:938a2d4ae661 396 GT511C3.Enroll(UserID,progress); //Enroll User with UserID of 1
davidbruce 3:938a2d4ae661 397
davidbruce 3:938a2d4ae661 398 if(GT511C3.CheckEnrolled(UserID) == 0) {
davidbruce 3:938a2d4ae661 399 N5110.clear();
davidbruce 3:938a2d4ae661 400 N5110.printString("Successfully",1,1);
davidbruce 3:938a2d4ae661 401 N5110.printString("Enrolled",1,2);
davidbruce 3:938a2d4ae661 402 N5110.refresh();
davidbruce 3:938a2d4ae661 403 wait(2); //If UserID is enrolled, print "Successfully Enrolled" on N5110 screen
davidbruce 3:938a2d4ae661 404
davidbruce 3:938a2d4ae661 405 GT511C3.CmosLed(1);
davidbruce 3:938a2d4ae661 406 Clock(); //Run Clock() This is seperate due to it being triggered in two places in the "register once, rebootable" version.
davidbruce 3:938a2d4ae661 407 }
davidbruce 3:938a2d4ae661 408 }
davidbruce 3:938a2d4ae661 409 }
davidbruce 3:938a2d4ae661 410
davidbruce 3:938a2d4ae661 411 void EnrollFP5(){
davidbruce 3:938a2d4ae661 412
davidbruce 3:938a2d4ae661 413 if(1){
davidbruce 3:938a2d4ae661 414 int UserID = 5; // Need to get this value from keyboard
davidbruce 3:938a2d4ae661 415 if(GT511C3.CheckEnrolled(UserID) == 0) { //If the User has previously been enrolled
davidbruce 3:938a2d4ae661 416 if(GT511C3.DeleteID(UserID) == 0){};//Delete User ID
davidbruce 3:938a2d4ae661 417 }
davidbruce 3:938a2d4ae661 418
davidbruce 3:938a2d4ae661 419 N5110.clear();
davidbruce 3:938a2d4ae661 420 N5110.printString("Place your",1,0);
davidbruce 3:938a2d4ae661 421 N5110.printString("finger on the",1,1);
davidbruce 3:938a2d4ae661 422 N5110.printString("sensor and",1,2);
davidbruce 3:938a2d4ae661 423 N5110.printString("remove it. Do",1,3);
davidbruce 3:938a2d4ae661 424 N5110.printString("until it is",1,4);
davidbruce 3:938a2d4ae661 425 N5110.printString("enrolled",1,5); //Instructions
davidbruce 3:938a2d4ae661 426 N5110.refresh();
davidbruce 3:938a2d4ae661 427
davidbruce 3:938a2d4ae661 428 GT511C3.Enroll(UserID,progress); //Enroll User with UserID of 1
davidbruce 3:938a2d4ae661 429
davidbruce 3:938a2d4ae661 430 if(GT511C3.CheckEnrolled(UserID) == 0) {
davidbruce 3:938a2d4ae661 431 N5110.clear();
davidbruce 3:938a2d4ae661 432 N5110.printString("Successfully",1,1);
davidbruce 3:938a2d4ae661 433 N5110.printString("Enrolled",1,2);
davidbruce 3:938a2d4ae661 434 N5110.refresh();
davidbruce 3:938a2d4ae661 435 wait(2); //If UserID is enrolled, print "Successfully Enrolled" on N5110 screen
davidbruce 3:938a2d4ae661 436
davidbruce 3:938a2d4ae661 437 GT511C3.CmosLed(1);
davidbruce 3:938a2d4ae661 438 Clock(); //Run Clock() This is seperate due to it being triggered in two places in the "register once, rebootable" version.
davidbruce 3:938a2d4ae661 439 }
davidbruce 3:938a2d4ae661 440 }
davidbruce 3:938a2d4ae661 441 }
davidbruce 3:938a2d4ae661 442
davidbruce 3:938a2d4ae661 443 void EnrollFP6(){
davidbruce 3:938a2d4ae661 444
davidbruce 3:938a2d4ae661 445 if(1){
davidbruce 3:938a2d4ae661 446 int UserID = 6; // Need to get this value from keyboard
davidbruce 3:938a2d4ae661 447 if(GT511C3.CheckEnrolled(UserID) == 0) { //If the User has previously been enrolled
davidbruce 3:938a2d4ae661 448 if(GT511C3.DeleteID(UserID) == 0){};//Delete User ID
davidbruce 3:938a2d4ae661 449 }
davidbruce 3:938a2d4ae661 450
davidbruce 3:938a2d4ae661 451 N5110.clear();
davidbruce 3:938a2d4ae661 452 N5110.printString("Place your",1,0);
davidbruce 3:938a2d4ae661 453 N5110.printString("finger on the",1,1);
davidbruce 3:938a2d4ae661 454 N5110.printString("sensor and",1,2);
davidbruce 3:938a2d4ae661 455 N5110.printString("remove it. Do",1,3);
davidbruce 3:938a2d4ae661 456 N5110.printString("until it is",1,4);
davidbruce 3:938a2d4ae661 457 N5110.printString("enrolled",1,5); //Instructions
davidbruce 3:938a2d4ae661 458 N5110.refresh();
beanmachine44 0:4bbfc068d864 459
davidbruce 3:938a2d4ae661 460 GT511C3.Enroll(UserID,progress); //Enroll User with UserID of 1
davidbruce 3:938a2d4ae661 461
davidbruce 3:938a2d4ae661 462 if(GT511C3.CheckEnrolled(UserID) == 0) {
davidbruce 3:938a2d4ae661 463 N5110.clear();
davidbruce 3:938a2d4ae661 464 N5110.printString("Successfully",1,1);
davidbruce 3:938a2d4ae661 465 N5110.printString("Enrolled",1,2);
davidbruce 3:938a2d4ae661 466 N5110.refresh();
davidbruce 3:938a2d4ae661 467 wait(2); //If UserID is enrolled, print "Successfully Enrolled" on N5110 screen
davidbruce 3:938a2d4ae661 468
davidbruce 3:938a2d4ae661 469 GT511C3.CmosLed(1);
davidbruce 3:938a2d4ae661 470 Clock(); //Run Clock() This is seperate due to it being triggered in two places in the "register once, rebootable" version.
davidbruce 3:938a2d4ae661 471 }
davidbruce 3:938a2d4ae661 472 }
davidbruce 3:938a2d4ae661 473 }
davidbruce 3:938a2d4ae661 474
davidbruce 3:938a2d4ae661 475 void EnrollFP7(){
davidbruce 3:938a2d4ae661 476
davidbruce 3:938a2d4ae661 477 if(1){
davidbruce 3:938a2d4ae661 478 int UserID = 7; // Need to get this value from keyboard
davidbruce 3:938a2d4ae661 479 if(GT511C3.CheckEnrolled(UserID) == 0) { //If the User has previously been enrolled
davidbruce 3:938a2d4ae661 480 if(GT511C3.DeleteID(UserID) == 0){};//Delete User ID
davidbruce 3:938a2d4ae661 481 }
davidbruce 3:938a2d4ae661 482
davidbruce 3:938a2d4ae661 483 N5110.clear();
davidbruce 3:938a2d4ae661 484 N5110.printString("Place your",1,0);
davidbruce 3:938a2d4ae661 485 N5110.printString("finger on the",1,1);
davidbruce 3:938a2d4ae661 486 N5110.printString("sensor and",1,2);
davidbruce 3:938a2d4ae661 487 N5110.printString("remove it. Do",1,3);
davidbruce 3:938a2d4ae661 488 N5110.printString("until it is",1,4);
davidbruce 3:938a2d4ae661 489 N5110.printString("enrolled",1,5); //Instructions
davidbruce 3:938a2d4ae661 490 N5110.refresh();
davidbruce 3:938a2d4ae661 491
davidbruce 3:938a2d4ae661 492 GT511C3.Enroll(UserID,progress); //Enroll User with UserID of 1
davidbruce 3:938a2d4ae661 493
davidbruce 3:938a2d4ae661 494 if(GT511C3.CheckEnrolled(UserID) == 0) {
davidbruce 3:938a2d4ae661 495 N5110.clear();
davidbruce 3:938a2d4ae661 496 N5110.printString("Successfully",1,1);
davidbruce 3:938a2d4ae661 497 N5110.printString("Enrolled",1,2);
davidbruce 3:938a2d4ae661 498 N5110.refresh();
davidbruce 3:938a2d4ae661 499 wait(2); //If UserID is enrolled, print "Successfully Enrolled" on N5110 screen
davidbruce 3:938a2d4ae661 500
davidbruce 3:938a2d4ae661 501 GT511C3.CmosLed(1);
davidbruce 3:938a2d4ae661 502 Clock(); //Run Clock() This is seperate due to it being triggered in two places in the "register once, rebootable" version.
davidbruce 3:938a2d4ae661 503 }
davidbruce 3:938a2d4ae661 504 }
davidbruce 3:938a2d4ae661 505 }
davidbruce 3:938a2d4ae661 506
davidbruce 3:938a2d4ae661 507 void EnrollFP8(){
davidbruce 3:938a2d4ae661 508
davidbruce 3:938a2d4ae661 509 if(1){
davidbruce 3:938a2d4ae661 510 int UserID = 8; // Need to get this value from keyboard
davidbruce 3:938a2d4ae661 511 if(GT511C3.CheckEnrolled(UserID) == 0) { //If the User has previously been enrolled
davidbruce 3:938a2d4ae661 512 if(GT511C3.DeleteID(UserID) == 0){};//Delete User ID
davidbruce 3:938a2d4ae661 513 }
davidbruce 3:938a2d4ae661 514
davidbruce 3:938a2d4ae661 515 N5110.clear();
davidbruce 3:938a2d4ae661 516 N5110.printString("Place your",1,0);
davidbruce 3:938a2d4ae661 517 N5110.printString("finger on the",1,1);
davidbruce 3:938a2d4ae661 518 N5110.printString("sensor and",1,2);
davidbruce 3:938a2d4ae661 519 N5110.printString("remove it. Do",1,3);
davidbruce 3:938a2d4ae661 520 N5110.printString("until it is",1,4);
davidbruce 3:938a2d4ae661 521 N5110.printString("enrolled",1,5); //Instructions
davidbruce 3:938a2d4ae661 522 N5110.refresh();
davidbruce 3:938a2d4ae661 523
davidbruce 3:938a2d4ae661 524 GT511C3.Enroll(UserID,progress); //Enroll User with UserID of 1
davidbruce 3:938a2d4ae661 525
davidbruce 3:938a2d4ae661 526 if(GT511C3.CheckEnrolled(UserID) == 0) {
davidbruce 3:938a2d4ae661 527 N5110.clear();
davidbruce 3:938a2d4ae661 528 N5110.printString("Successfully",1,1);
davidbruce 3:938a2d4ae661 529 N5110.printString("Enrolled",1,2);
davidbruce 3:938a2d4ae661 530 N5110.refresh();
davidbruce 3:938a2d4ae661 531 wait(2); //If UserID is enrolled, print "Successfully Enrolled" on N5110 screen
davidbruce 3:938a2d4ae661 532
davidbruce 3:938a2d4ae661 533 GT511C3.CmosLed(1);
davidbruce 3:938a2d4ae661 534 Clock(); //Run Clock() This is seperate due to it being triggered in two places in the "register once, rebootable" version.
davidbruce 3:938a2d4ae661 535 }
davidbruce 3:938a2d4ae661 536 }
davidbruce 3:938a2d4ae661 537 }
davidbruce 3:938a2d4ae661 538
davidbruce 3:938a2d4ae661 539 void EnrollFP9(){
davidbruce 3:938a2d4ae661 540
davidbruce 3:938a2d4ae661 541 if(1){
davidbruce 3:938a2d4ae661 542 int UserID = 9; // Need to get this value from keyboard
davidbruce 3:938a2d4ae661 543 if(GT511C3.CheckEnrolled(UserID) == 0) { //If the User has previously been enrolled
davidbruce 3:938a2d4ae661 544 if(GT511C3.DeleteID(UserID) == 0){};//Delete User ID
davidbruce 3:938a2d4ae661 545 }
davidbruce 3:938a2d4ae661 546
davidbruce 3:938a2d4ae661 547 N5110.clear();
davidbruce 3:938a2d4ae661 548 N5110.printString("Place your",1,0);
davidbruce 3:938a2d4ae661 549 N5110.printString("finger on the",1,1);
davidbruce 3:938a2d4ae661 550 N5110.printString("sensor and",1,2);
davidbruce 3:938a2d4ae661 551 N5110.printString("remove it. Do",1,3);
davidbruce 3:938a2d4ae661 552 N5110.printString("until it is",1,4);
davidbruce 3:938a2d4ae661 553 N5110.printString("enrolled",1,5); //Instructions
davidbruce 3:938a2d4ae661 554 N5110.refresh();
davidbruce 3:938a2d4ae661 555
davidbruce 3:938a2d4ae661 556 GT511C3.Enroll(UserID,progress); //Enroll User with UserID of 1
davidbruce 3:938a2d4ae661 557
davidbruce 3:938a2d4ae661 558 if(GT511C3.CheckEnrolled(UserID) == 0) {
davidbruce 3:938a2d4ae661 559 N5110.clear();
davidbruce 3:938a2d4ae661 560 N5110.printString("Successfully",1,1);
davidbruce 3:938a2d4ae661 561 N5110.printString("Enrolled",1,2);
davidbruce 3:938a2d4ae661 562 N5110.refresh();
davidbruce 3:938a2d4ae661 563 wait(2); //If UserID is enrolled, print "Successfully Enrolled" on N5110 screen
davidbruce 3:938a2d4ae661 564
davidbruce 3:938a2d4ae661 565 GT511C3.CmosLed(1);
davidbruce 3:938a2d4ae661 566 Clock(); //Run Clock() This is seperate due to it being triggered in two places in the "register once, rebootable" version.
davidbruce 3:938a2d4ae661 567 }
davidbruce 3:938a2d4ae661 568 }
davidbruce 3:938a2d4ae661 569 }
davidbruce 3:938a2d4ae661 570
davidbruce 3:938a2d4ae661 571 void Clock(){ //This part of the code identifies the fingerprint, checks if it is enrolled and if so whether they are clocking in or clocking out
beanmachine44 0:4bbfc068d864 572 while(1) {
davidbruce 3:938a2d4ae661 573 int reset = 0;
davidbruce 3:938a2d4ae661 574 N5110.clear();
davidbruce 3:938a2d4ae661 575 N5110.printString("Scan Finger to",1,2);
davidbruce 3:938a2d4ae661 576 N5110.printString("Clock In/Out",1,3);
davidbruce 3:938a2d4ae661 577 N5110.refresh();
davidbruce 3:938a2d4ae661 578
davidbruce 3:938a2d4ae661 579
davidbruce 3:938a2d4ae661 580 GT511C3.WaitPress(1); //Code waits for a press
davidbruce 3:938a2d4ae661 581 if(GT511C3.Capture(1) != 0) continue; //Makes sure the scan of the fingerprint is a good one
davidbruce 3:938a2d4ae661 582 UserIDDetect = GT511C3.Identify(); //Detects the UserID of the press
davidbruce 3:938a2d4ae661 583
davidbruce 3:938a2d4ae661 584
davidbruce 3:938a2d4ae661 585 if (UserIDDetect ==-1) { //If -1, it is not registered
davidbruce 3:938a2d4ae661 586 N5110.clear();
davidbruce 3:938a2d4ae661 587 N5110.printString("Fingerprint",1,0);
davidbruce 3:938a2d4ae661 588 N5110.printString("Not Recognised",1,1);
davidbruce 3:938a2d4ae661 589 N5110.refresh();
davidbruce 3:938a2d4ae661 590 wait(3);
davidbruce 3:938a2d4ae661 591 };
davidbruce 3:938a2d4ae661 592
davidbruce 3:938a2d4ae661 593 if ((UserIDDetect == 1) && (clkcheck1 == 0) && (reset == 0)){//If 1, it is the registered print, clkcheck 0 means the last action was a clock out
davidbruce 3:938a2d4ae661 594 N5110.clear();
davidbruce 3:938a2d4ae661 595
davidbruce 3:938a2d4ae661 596 N5110.printString("User 1",1,1);
davidbruce 3:938a2d4ae661 597 N5110.printString("Clocked in",1,2);
davidbruce 3:938a2d4ae661 598 serial.printf("Clocked in" __DATE__);
davidbruce 3:938a2d4ae661 599 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 600 serial.printf("User:1");
davidbruce 3:938a2d4ae661 601 N5110.refresh();
davidbruce 3:938a2d4ae661 602 clkcheck1 = -1;
davidbruce 3:938a2d4ae661 603 reset = 1;//Clock in and out both require reset 0, and both change reset to 1 for 3 seconds to stop the code automaticlaly switching between both while UserIDDetect = 1
davidbruce 3:938a2d4ae661 604 wait(3);
davidbruce 3:938a2d4ae661 605 };
davidbruce 3:938a2d4ae661 606
davidbruce 3:938a2d4ae661 607
davidbruce 3:938a2d4ae661 608 if ((UserIDDetect == 1) && (clkcheck1 == -1) && (reset == 0)){
davidbruce 3:938a2d4ae661 609 N5110.clear();
davidbruce 3:938a2d4ae661 610
davidbruce 3:938a2d4ae661 611 N5110.printString("User 1",1,1);
davidbruce 3:938a2d4ae661 612 N5110.printString("Clocked Out",1,2);
davidbruce 3:938a2d4ae661 613 serial.printf("Clocked Out" __DATE__);
davidbruce 3:938a2d4ae661 614 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 615 serial.printf("User:1");
davidbruce 3:938a2d4ae661 616 N5110.refresh();
davidbruce 3:938a2d4ae661 617
davidbruce 3:938a2d4ae661 618 N5110.refresh();
davidbruce 3:938a2d4ae661 619 clkcheck1 = 0;
davidbruce 3:938a2d4ae661 620 reset = 1;
davidbruce 3:938a2d4ae661 621 wait(3);
davidbruce 3:938a2d4ae661 622 };
davidbruce 3:938a2d4ae661 623
davidbruce 3:938a2d4ae661 624 if ((UserIDDetect == 2) && (clkcheck2 == 0) && (reset == 0)){//If 1, it is the registered print, clkcheck 0 means the last action was a clock out
davidbruce 3:938a2d4ae661 625 N5110.clear();
davidbruce 3:938a2d4ae661 626
davidbruce 3:938a2d4ae661 627 N5110.printString("User 2",1,1);
davidbruce 3:938a2d4ae661 628 N5110.printString("Clocked in",1,2);
davidbruce 3:938a2d4ae661 629 serial.printf("Clocked in" __DATE__);
davidbruce 3:938a2d4ae661 630 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 631 serial.printf("User:2");
davidbruce 3:938a2d4ae661 632 N5110.refresh();
davidbruce 3:938a2d4ae661 633 clkcheck2 = -1;
davidbruce 3:938a2d4ae661 634 reset = 1;//Clock in and out both require reset 0, and both change reset to 1 for 3 seconds to stop the code automaticlaly switching between both while UserIDDetect = 1
davidbruce 3:938a2d4ae661 635 wait(3);
davidbruce 3:938a2d4ae661 636 };
davidbruce 3:938a2d4ae661 637
davidbruce 3:938a2d4ae661 638
davidbruce 3:938a2d4ae661 639 if ((UserIDDetect == 2) && (clkcheck2 == -1) && (reset == 0)){
davidbruce 3:938a2d4ae661 640 N5110.clear();
davidbruce 3:938a2d4ae661 641
davidbruce 3:938a2d4ae661 642 N5110.printString("User 2",1,1);
davidbruce 3:938a2d4ae661 643 N5110.printString("Clocked Out",1,2);
davidbruce 3:938a2d4ae661 644 serial.printf("Clocked Out" __DATE__);
davidbruce 3:938a2d4ae661 645 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 646 serial.printf("User:2");
davidbruce 3:938a2d4ae661 647 N5110.refresh();
davidbruce 3:938a2d4ae661 648
davidbruce 3:938a2d4ae661 649 N5110.refresh();
davidbruce 3:938a2d4ae661 650 clkcheck2 = 0;
davidbruce 3:938a2d4ae661 651 reset = 1;
davidbruce 3:938a2d4ae661 652 wait(3);
davidbruce 3:938a2d4ae661 653 };
davidbruce 3:938a2d4ae661 654
davidbruce 3:938a2d4ae661 655 if ((UserIDDetect == 3) && (clkcheck3 == 0) && (reset == 0)){//If 1, it is the registered print, clkcheck 0 means the last action was a clock out
davidbruce 3:938a2d4ae661 656 N5110.clear();
beanmachine44 2:61e0f5bec6ff 657
davidbruce 3:938a2d4ae661 658 N5110.printString("User 3",1,1);
davidbruce 3:938a2d4ae661 659 N5110.printString("Clocked in",1,2);
davidbruce 3:938a2d4ae661 660 serial.printf("Clocked in" __DATE__);
davidbruce 3:938a2d4ae661 661 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 662 serial.printf("User:3");
davidbruce 3:938a2d4ae661 663 N5110.refresh();
davidbruce 3:938a2d4ae661 664 clkcheck3 = -1;
davidbruce 3:938a2d4ae661 665 reset = 1;//Clock in and out both require reset 0, and both change reset to 1 for 3 seconds to stop the code automaticlaly switching between both while UserIDDetect = 1
davidbruce 3:938a2d4ae661 666 wait(3);
davidbruce 3:938a2d4ae661 667 };
davidbruce 3:938a2d4ae661 668
davidbruce 3:938a2d4ae661 669
davidbruce 3:938a2d4ae661 670 if ((UserIDDetect == 3) && (clkcheck3 == -1) && (reset == 0)){
davidbruce 3:938a2d4ae661 671 N5110.clear();
davidbruce 3:938a2d4ae661 672
davidbruce 3:938a2d4ae661 673 N5110.printString("User 3",1,1);
davidbruce 3:938a2d4ae661 674 N5110.printString("Clocked Out",1,2);
davidbruce 3:938a2d4ae661 675 serial.printf("Clocked Out" __DATE__);
davidbruce 3:938a2d4ae661 676 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 677 serial.printf("User:3");
davidbruce 3:938a2d4ae661 678 N5110.refresh();
davidbruce 3:938a2d4ae661 679
davidbruce 3:938a2d4ae661 680 N5110.refresh();
davidbruce 3:938a2d4ae661 681 clkcheck3 = 0;
davidbruce 3:938a2d4ae661 682 reset = 1;
davidbruce 3:938a2d4ae661 683 wait(3);
davidbruce 3:938a2d4ae661 684 };
davidbruce 3:938a2d4ae661 685
davidbruce 3:938a2d4ae661 686 if ((UserIDDetect == 4) && (clkcheck4 == 0) && (reset == 0)){//If 1, it is the registered print, clkcheck 0 means the last action was a clock out
davidbruce 3:938a2d4ae661 687 N5110.clear();
davidbruce 3:938a2d4ae661 688
davidbruce 3:938a2d4ae661 689 N5110.printString("User 4",1,1);
davidbruce 3:938a2d4ae661 690 N5110.printString("Clocked in",1,2);
davidbruce 3:938a2d4ae661 691 serial.printf("Clocked in" __DATE__);
davidbruce 3:938a2d4ae661 692 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 693 serial.printf("User:4");
davidbruce 3:938a2d4ae661 694 N5110.refresh();
davidbruce 3:938a2d4ae661 695 clkcheck4 = -1;
davidbruce 3:938a2d4ae661 696 reset = 1;//Clock in and out both require reset 0, and both change reset to 1 for 3 seconds to stop the code automaticlaly switching between both while UserIDDetect = 1
davidbruce 3:938a2d4ae661 697 wait(3);
davidbruce 3:938a2d4ae661 698 };
davidbruce 3:938a2d4ae661 699
davidbruce 3:938a2d4ae661 700
davidbruce 3:938a2d4ae661 701 if ((UserIDDetect == 4) && (clkcheck4 == -1) && (reset == 0)){
davidbruce 3:938a2d4ae661 702 N5110.clear();
davidbruce 3:938a2d4ae661 703
davidbruce 3:938a2d4ae661 704 N5110.printString("User 4",1,1);
davidbruce 3:938a2d4ae661 705 N5110.printString("Clocked Out",1,2);
davidbruce 3:938a2d4ae661 706 serial.printf("Clocked Out" __DATE__);
davidbruce 3:938a2d4ae661 707 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 708 serial.printf("User:4");
davidbruce 3:938a2d4ae661 709 N5110.refresh();
davidbruce 3:938a2d4ae661 710
davidbruce 3:938a2d4ae661 711 N5110.refresh();
davidbruce 3:938a2d4ae661 712 clkcheck4 = 0;
davidbruce 3:938a2d4ae661 713 reset = 1;
davidbruce 3:938a2d4ae661 714 wait(3);
davidbruce 3:938a2d4ae661 715 };
davidbruce 3:938a2d4ae661 716
davidbruce 3:938a2d4ae661 717 if ((UserIDDetect == 5) && (clkcheck5 == 0) && (reset == 0)){//If 1, it is the registered print, clkcheck 0 means the last action was a clock out
davidbruce 3:938a2d4ae661 718 N5110.clear();
davidbruce 3:938a2d4ae661 719
davidbruce 3:938a2d4ae661 720 N5110.printString("User 5",1,1);
davidbruce 3:938a2d4ae661 721 N5110.printString("Clocked in",1,2);
davidbruce 3:938a2d4ae661 722 serial.printf("Clocked in" __DATE__);
davidbruce 3:938a2d4ae661 723 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 724 serial.printf("User:5");
davidbruce 3:938a2d4ae661 725 N5110.refresh();
davidbruce 3:938a2d4ae661 726 clkcheck5 = -1;
davidbruce 3:938a2d4ae661 727 reset = 1;//Clock in and out both require reset 0, and both change reset to 1 for 3 seconds to stop the code automaticlaly switching between both while UserIDDetect = 1
davidbruce 3:938a2d4ae661 728 wait(3);
davidbruce 3:938a2d4ae661 729 };
davidbruce 3:938a2d4ae661 730
davidbruce 3:938a2d4ae661 731
davidbruce 3:938a2d4ae661 732 if ((UserIDDetect == 5) && (clkcheck5 == -1) && (reset == 0)){
davidbruce 3:938a2d4ae661 733 N5110.clear();
davidbruce 3:938a2d4ae661 734
davidbruce 3:938a2d4ae661 735 N5110.printString("User 5",1,1);
davidbruce 3:938a2d4ae661 736 N5110.printString("Clocked Out",1,2);
davidbruce 3:938a2d4ae661 737 serial.printf("Clocked Out" __DATE__);
davidbruce 3:938a2d4ae661 738 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 739 serial.printf("User:5");
davidbruce 3:938a2d4ae661 740 N5110.refresh();
davidbruce 3:938a2d4ae661 741
davidbruce 3:938a2d4ae661 742 N5110.refresh();
davidbruce 3:938a2d4ae661 743 clkcheck5 = 0;
davidbruce 3:938a2d4ae661 744 reset = 1;
davidbruce 3:938a2d4ae661 745 wait(3);
davidbruce 3:938a2d4ae661 746 };
davidbruce 3:938a2d4ae661 747
davidbruce 3:938a2d4ae661 748 if ((UserIDDetect == 6) && (clkcheck6 == 0) && (reset == 0)){//If 1, it is the registered print, clkcheck 0 means the last action was a clock out
davidbruce 3:938a2d4ae661 749 N5110.clear();
davidbruce 3:938a2d4ae661 750
davidbruce 3:938a2d4ae661 751 N5110.printString("User 6",1,1);
davidbruce 3:938a2d4ae661 752 N5110.printString("Clocked in",1,2);
davidbruce 3:938a2d4ae661 753 serial.printf("Clocked in" __DATE__);
davidbruce 3:938a2d4ae661 754 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 755 serial.printf("User:6");
davidbruce 3:938a2d4ae661 756 N5110.refresh();
davidbruce 3:938a2d4ae661 757 clkcheck6 = -1;
davidbruce 3:938a2d4ae661 758 reset = 1;//Clock in and out both require reset 0, and both change reset to 1 for 3 seconds to stop the code automaticlaly switching between both while UserIDDetect = 1
davidbruce 3:938a2d4ae661 759 wait(3);
davidbruce 3:938a2d4ae661 760 };
davidbruce 3:938a2d4ae661 761
beanmachine44 2:61e0f5bec6ff 762
davidbruce 3:938a2d4ae661 763 if ((UserIDDetect == 6) && (clkcheck6 == -1) && (reset == 0)){
davidbruce 3:938a2d4ae661 764 N5110.clear();
davidbruce 3:938a2d4ae661 765
davidbruce 3:938a2d4ae661 766 N5110.printString("User 6",1,1);
davidbruce 3:938a2d4ae661 767 N5110.printString("Clocked Out",1,2);
davidbruce 3:938a2d4ae661 768 serial.printf("Clocked Out" __DATE__);
davidbruce 3:938a2d4ae661 769 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 770 serial.printf("User:6");
davidbruce 3:938a2d4ae661 771 N5110.refresh();
davidbruce 3:938a2d4ae661 772
davidbruce 3:938a2d4ae661 773 N5110.refresh();
davidbruce 3:938a2d4ae661 774 clkcheck6 = 0;
davidbruce 3:938a2d4ae661 775 reset = 1;
davidbruce 3:938a2d4ae661 776 wait(3);
davidbruce 3:938a2d4ae661 777 };
davidbruce 3:938a2d4ae661 778
davidbruce 3:938a2d4ae661 779 if ((UserIDDetect == 7) && (clkcheck7 == 0) && (reset == 0)){//If 1, it is the registered print, clkcheck 0 means the last action was a clock out
davidbruce 3:938a2d4ae661 780 N5110.clear();
davidbruce 3:938a2d4ae661 781
davidbruce 3:938a2d4ae661 782 N5110.printString("User 7",1,1);
davidbruce 3:938a2d4ae661 783 N5110.printString("Clocked in",1,2);
davidbruce 3:938a2d4ae661 784 serial.printf("Clocked in" __DATE__);
davidbruce 3:938a2d4ae661 785 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 786 serial.printf("User:7");
davidbruce 3:938a2d4ae661 787 N5110.refresh();
davidbruce 3:938a2d4ae661 788 clkcheck7 = -1;
davidbruce 3:938a2d4ae661 789 reset = 1;//Clock in and out both require reset 0, and both change reset to 1 for 3 seconds to stop the code automaticlaly switching between both while UserIDDetect = 1
davidbruce 3:938a2d4ae661 790 wait(3);
davidbruce 3:938a2d4ae661 791 };
davidbruce 3:938a2d4ae661 792
davidbruce 3:938a2d4ae661 793
davidbruce 3:938a2d4ae661 794 if ((UserIDDetect == 7) && (clkcheck7 == -1) && (reset == 0)){
davidbruce 3:938a2d4ae661 795 N5110.clear();
davidbruce 3:938a2d4ae661 796
davidbruce 3:938a2d4ae661 797 N5110.printString("User 7",1,1);
davidbruce 3:938a2d4ae661 798 N5110.printString("Clocked Out",1,2);
davidbruce 3:938a2d4ae661 799 serial.printf("Clocked Out" __DATE__);
davidbruce 3:938a2d4ae661 800 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 801 serial.printf("User:7");
davidbruce 3:938a2d4ae661 802 N5110.refresh();
davidbruce 3:938a2d4ae661 803
davidbruce 3:938a2d4ae661 804 N5110.refresh();
davidbruce 3:938a2d4ae661 805 clkcheck7 = 0;
davidbruce 3:938a2d4ae661 806 reset = 1;
davidbruce 3:938a2d4ae661 807 wait(3);
davidbruce 3:938a2d4ae661 808 };
beanmachine44 2:61e0f5bec6ff 809
davidbruce 3:938a2d4ae661 810 if ((UserIDDetect == 8) && (clkcheck8 == 0) && (reset == 0)){//If 1, it is the registered print, clkcheck 0 means the last action was a clock out
davidbruce 3:938a2d4ae661 811 N5110.clear();
davidbruce 3:938a2d4ae661 812
davidbruce 3:938a2d4ae661 813 N5110.printString("User 8",1,1);
davidbruce 3:938a2d4ae661 814 N5110.printString("Clocked in",1,2);
davidbruce 3:938a2d4ae661 815 serial.printf("Clocked in" __DATE__);
davidbruce 3:938a2d4ae661 816 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 817 serial.printf("User:8");
davidbruce 3:938a2d4ae661 818 N5110.refresh();
davidbruce 3:938a2d4ae661 819 clkcheck8 = -1;
davidbruce 3:938a2d4ae661 820 reset = 1;//Clock in and out both require reset 0, and both change reset to 1 for 3 seconds to stop the code automaticlaly switching between both while UserIDDetect = 1
davidbruce 3:938a2d4ae661 821 wait(3);
davidbruce 3:938a2d4ae661 822 };
davidbruce 3:938a2d4ae661 823
davidbruce 3:938a2d4ae661 824
davidbruce 3:938a2d4ae661 825 if ((UserIDDetect == 8) && (clkcheck8 == -1) && (reset == 0)){
davidbruce 3:938a2d4ae661 826 N5110.clear();
davidbruce 3:938a2d4ae661 827
davidbruce 3:938a2d4ae661 828 N5110.printString("User 8",1,1);
davidbruce 3:938a2d4ae661 829 N5110.printString("Clocked Out",1,2);
davidbruce 3:938a2d4ae661 830 serial.printf("Clocked Out" __DATE__);
davidbruce 3:938a2d4ae661 831 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 832 serial.printf("User:8");
davidbruce 3:938a2d4ae661 833 N5110.refresh();
davidbruce 3:938a2d4ae661 834
davidbruce 3:938a2d4ae661 835 N5110.refresh();
davidbruce 3:938a2d4ae661 836 clkcheck8 = 0;
davidbruce 3:938a2d4ae661 837 reset = 1;
davidbruce 3:938a2d4ae661 838 wait(3);
davidbruce 3:938a2d4ae661 839 };
davidbruce 3:938a2d4ae661 840
davidbruce 3:938a2d4ae661 841 if ((UserIDDetect == 9) && (clkcheck9 == 0) && (reset == 0)){//If 1, it is the registered print, clkcheck 0 means the last action was a clock out
davidbruce 3:938a2d4ae661 842 N5110.clear();
davidbruce 3:938a2d4ae661 843
davidbruce 3:938a2d4ae661 844 N5110.printString("User 9",1,1);
davidbruce 3:938a2d4ae661 845 N5110.printString("Clocked in",1,2);
davidbruce 3:938a2d4ae661 846 serial.printf("Clocked in" __DATE__);
davidbruce 3:938a2d4ae661 847 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 848 serial.printf("User:9");
davidbruce 3:938a2d4ae661 849 N5110.refresh();
davidbruce 3:938a2d4ae661 850 clkcheck9 = -1;
davidbruce 3:938a2d4ae661 851 reset = 1;//Clock in and out both require reset 0, and both change reset to 1 for 3 seconds to stop the code automaticlaly switching between both while UserIDDetect = 1
davidbruce 3:938a2d4ae661 852 wait(3);
davidbruce 3:938a2d4ae661 853 };
davidbruce 3:938a2d4ae661 854
davidbruce 3:938a2d4ae661 855
davidbruce 3:938a2d4ae661 856 if ((UserIDDetect == 9) && (clkcheck9 == -1) && (reset == 0)){
davidbruce 3:938a2d4ae661 857 N5110.clear();
davidbruce 3:938a2d4ae661 858
davidbruce 3:938a2d4ae661 859 N5110.printString("User 9",1,1);
davidbruce 3:938a2d4ae661 860 N5110.printString("Clocked Out",1,2);
davidbruce 3:938a2d4ae661 861 serial.printf("Clocked Out" __DATE__);
davidbruce 3:938a2d4ae661 862 serial.printf("Time:"__TIME__);
davidbruce 3:938a2d4ae661 863 serial.printf("User:9");
davidbruce 3:938a2d4ae661 864 N5110.refresh();
davidbruce 3:938a2d4ae661 865
davidbruce 3:938a2d4ae661 866 N5110.refresh();
davidbruce 3:938a2d4ae661 867 clkcheck9 = 0;
davidbruce 3:938a2d4ae661 868 reset = 1;
davidbruce 3:938a2d4ae661 869 wait(3);
davidbruce 3:938a2d4ae661 870 };
davidbruce 3:938a2d4ae661 871
davidbruce 3:938a2d4ae661 872 GT511C3.WaitPress(0); //Code waits for no press before looping
beanmachine44 0:4bbfc068d864 873 }
davidbruce 3:938a2d4ae661 874 }