Advertisement
Guest User

fingerprint3.ino

a guest
Nov 8th, 2020
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.45 KB | None | 0 0
  1. /*
  2.  
  3.     Copyright (c) 2019 Seeed Technology Co., Ltd.
  4.     Website    : www.seeed.cc
  5.     Author     : downey
  6.     Create Time: Jun 2019
  7.     Change Log :
  8.  
  9.     The MIT License (MIT)
  10.  
  11.     Permission is hereby granted, free of charge, to any person obtaining a copy
  12.     of this software and associated documentation files (the "Software"), to deal
  13.     in the Software without restriction, including without limitation the rights
  14.     to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  15.     copies of the Software, and to permit persons to whom the Software is
  16.     furnished to do so, subject to the following conditions:
  17.  
  18.     The above copyright notice and this permission notice shall be included in
  19.     all copies or substantial portions of the Software.
  20.  
  21.     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  22.     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  23.     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  24.     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  25.     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  26.     OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  27.     THE SOFTWARE.
  28. */#include "ATSerial.h"
  29. #include "Protocol.h"
  30. #include "KCT202.h"
  31.  
  32.  
  33. #if defined(ARDUINO_ARCH_AVR)
  34.     #define debug  Serial
  35.     SoftwareSerial uart(2, 3);
  36.     FingerPrint_KCT202<SoftwareSerial, HardwareSerial> kct202;
  37.  
  38. #elif defined(ARDUINO_ARCH_SAM)
  39.     #define debug  SerialUSB
  40.     #define uart Serial
  41.     //FingerPrint_KCT202<HardwareSerial,HardwareSerial> kct202;
  42.     //FingerPrint_KCT202<HardwareSerial,Serial_> kct202;
  43.     FingerPrint_KCT202<Uart, Serial_> kct202;
  44. #elif defined(ARDUINO_ARCH_SAMD)
  45.     #define debug  SerialUSB
  46.     #define uart Serial
  47.     //FingerPrint_KCT202<HardwareSerial,HardwareSerial> kct202;
  48.     FingerPrint_KCT202<Uart, Serial_> kct202;
  49.  
  50. #else
  51.     #define debug  Serial
  52.     SoftwareSerial uart(14, 12); //RX: D5, TX: D6
  53.     FingerPrint_KCT202<SoftwareSerial, HardwareSerial> kct202;
  54. #endif
  55.  
  56.  
  57.  
  58. Protocol_oprt oprt;
  59. uint8_t err_code = 0;
  60. uint8_t param[10];
  61. uint32_t param_len;
  62.  
  63. void setup(void) {
  64.     debug.begin(115200);
  65.     kct202.begin(uart, debug);
  66. }
  67.  
  68.  
  69. void loop(void) {
  70.     /** If there is a directive is running, we cancel it and execute the next directive.
  71.         Actually,this directive just for showing how it works here,In most case, it is unnecessary.  .
  72.      * */
  73.     //kct202.cancelAction();
  74.     //kct202.getCommonResponAndparse(err_code,param,param_len);
  75.  
  76.     //Specify the finger print ID 0x01,collect four times finger-print。
  77.     //If there is finger-print which ID is 0x01 already,Then a error occurred.  lack of "OVERRIDE_CURR_FINGER_PRINT"
  78.     kct202.autoRegisterFingerPrint(1, 4, LED_OFF_AFTER_GET_GRAGH |
  79.                                    PRETREATMENT_GRAGH | NOT_RET_FOR_EVERY_STEP | OVERRIDE_CURR_FINGER_PRINT);
  80.     debug.println(" ");
  81.     debug.println("Usage:");
  82.     debug.println("    Please put your finger on the touchpad, from green light which on the touchpad lights on till it lights off.");
  83.     debug.println("    Repeat for 4 times.");
  84.     debug.println("    If the red light lights on, it indicates that an error occurred.");
  85.     debug.println(" ");
  86.     debug.println(" ");
  87.     debug.println(" ");
  88.     if (0 == kct202.getRegisterResponAndparse()) {
  89.         debug.println("Register ok!");
  90.     }
  91.     while (1);
  92. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement