Started adding Enroll funktions and ble parsing
This commit is contained in:
parent
7e482344d2
commit
9ac2327812
30
beerbox.ino
30
beerbox.ino
@ -21,6 +21,7 @@ char toprint[255];
|
|||||||
Beerbox *box;
|
Beerbox *box;
|
||||||
|
|
||||||
int drinksMax = 1; // TODO add this to the box struct
|
int drinksMax = 1; // TODO add this to the box struct
|
||||||
|
int maxID = 0;
|
||||||
int lastButtonState = 1;
|
int lastButtonState = 1;
|
||||||
|
|
||||||
int currentDrink = 0;
|
int currentDrink = 0;
|
||||||
@ -54,6 +55,9 @@ void setup() {
|
|||||||
// RFID Reader init
|
// RFID Reader init
|
||||||
Serial1.begin(9600);
|
Serial1.begin(9600);
|
||||||
|
|
||||||
|
// BLE Com init
|
||||||
|
Serial3.begin(115200);
|
||||||
|
|
||||||
|
|
||||||
Serial.print("Initializing SD card...");
|
Serial.print("Initializing SD card...");
|
||||||
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
|
// On the Ethernet Shield, CS is pin 4. It's set as an output by default.
|
||||||
@ -94,6 +98,31 @@ void loop() {
|
|||||||
|
|
||||||
boxTimer();
|
boxTimer();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (Serial3.available() > 0) {
|
||||||
|
char incomingByte = Serial3.read();
|
||||||
|
if (incomingByte == '!') { //2 createnew user
|
||||||
|
incomingByte = Serial3.read();
|
||||||
|
String personName;
|
||||||
|
while (incomingByte != ';')
|
||||||
|
{
|
||||||
|
personName = String(personName + incomingByte);
|
||||||
|
incomingByte = Serial3.read();
|
||||||
|
}
|
||||||
|
Serial.println(personName);
|
||||||
|
lcd.clear();
|
||||||
|
lcd.print(personName);
|
||||||
|
//lcd.setCursor(0,1);
|
||||||
|
//lcd.print("Fin pls");
|
||||||
|
//while(getFingerprintEnroll(maxID+1)!=0)
|
||||||
|
maxID++;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}//end loop
|
}//end loop
|
||||||
|
|
||||||
|
|
||||||
@ -245,6 +274,7 @@ void print_person(Beerbox *box, Person *aperson) {
|
|||||||
sprintf(toprint, "rfid_uuid: %s\n", aperson->rfid_uuid);
|
sprintf(toprint, "rfid_uuid: %s\n", aperson->rfid_uuid);
|
||||||
Serial.write(toprint);
|
Serial.write(toprint);
|
||||||
sprintf(toprint, "finger_uuid: %u\n", aperson->finger_uuid);
|
sprintf(toprint, "finger_uuid: %u\n", aperson->finger_uuid);
|
||||||
|
if(aperson->finger_uuid > maxID) maxID=aperson->finger_uuid;
|
||||||
Serial.print(toprint);
|
Serial.print(toprint);
|
||||||
sprintf(toprint, "credits_left: %u\n", aperson->credits_left);
|
sprintf(toprint, "credits_left: %u\n", aperson->credits_left);
|
||||||
Serial.print(toprint);
|
Serial.print(toprint);
|
||||||
|
Loading…
Reference in New Issue
Block a user