diff --git a/ReadRawData/py_fp_image.py b/ReadRawData/py_fp_image.py index e0b3a7f43c1a65c90799d380b7290ba9bf7149cc..35bca6ae09f8451e2f096fac82011abe3d4f7887 100644 --- a/ReadRawData/py_fp_image.py +++ b/ReadRawData/py_fp_image.py @@ -6,12 +6,12 @@ temps = [] # replace space to new line -with open("fp_data4.txt", "r") as r: - with open("fp_data4_new.txt", "w") as w: +with open("fp_data6.txt", "r") as r: + with open("fp_data6_new.txt", "w") as w: w.write(r.read().replace(' ' , '\n')) # Open text file and write to temp list -f = open('fp_data4_new.txt') +f = open('fp_data6_new.txt') for line in f.readlines(): try: diff --git a/ReadRawData/src/src.cpp b/ReadRawData/src/src.cpp index 1f60a73c39c1f1803167603dcb975ad895b14629..5a63a076326d44e47943cc6cec12b2c05b94b327 100644 --- a/ReadRawData/src/src.cpp +++ b/ReadRawData/src/src.cpp @@ -20,7 +20,7 @@ DFRobot_ID809 fingerprint; uint8_t ID, i, ret; - +uint8_t data[25600]; /*-----Blink on board led -------------- */ void blink_led() { @@ -30,35 +30,34 @@ void blink_led() { delay(500); } +/*--------- Send raw data to serial port----*/ + +void serialPrintFPdata() { + for (uint16_t i = 0; i < 25600; i++) { + // Serial.print(i); + // Serial.print('\t'); + Serial.print(data[i]); + Serial.print(" "); + delay(10); + } + // Serial.println(); + // Serial.flush(); +} + /*----- Read fingerpritn image data ------*/ void read_image() { // Full image of fingerprint - uint8_t data[25600] = {0}; + // uint8_t data[25600] = {0}; /*Set the fingerprint module LED ring to blue breathing lighting effect*/ fingerprint.ctrlLED(/*LEDMode = */ fingerprint.eBreathing, /*LEDColor = */ fingerprint.eLEDBlue, /*blinkCount = */ 0); // Serial.println("Please release your finger"); - /*Wait for finger to release - Return 1 when finger is detected, otherwise return 0 - */ - while (!fingerprint.detectFinger()); // Collect full images fingerprint.getFingerImage(data); delay(100); - for (uint16_t i = 0; i < 25600; i++) { - // Serial.print(i); - // Serial.print('\t'); - Serial.print(data[i]); - Serial.print(" "); - delay(10); - } - Serial.println(); - Serial.flush(); - - blink_led(); } /*---------Arduino setup function------*/ @@ -82,6 +81,13 @@ void setup() { void loop() { - read_image(); + /*Wait for finger to release +Return 1 when finger is detected, otherwise return 0 +*/ + while (!fingerprint.detectFinger()) { + blink_led(); + } + read_image(); + serialPrintFPdata(); }