G1 (RX)
and G2 (TX)
./**
* @file Unit_Finger_M5CoreS3.ino
* @author Zovey (liangzhuowei@m5stack.com)
* @brief
* @version 0.1
* @date 2025-07-04
*
*
* @Hardwares: M5CoreS3 + Unit Finger
* @Dependent Library:
* M5_FPC1020A: https://github.com/m5stack/M5-FPC1020A
*/
#include "M5Unified.h"
#include "M5_FPC1020A.h"
M5_FPC1020A finger;
bool add_user_process(uint8_t id, uint8_t permission);
bool id_input = 1, id_Verification = 1, id_delete = 1;
void setup() {
M5.begin();
Serial.begin(115200);
M5.Display.fillRect(0, 0, 320, 240, WHITE);
M5.Display.setTextColor(BLACK);
M5.Display.setFont(&fonts::FreeMonoBold9pt7b);
M5.Display.setCursor(0, 0);
M5.Display.println("Finger Unit init...");
if (!finger.begin(&Serial2, 1, 2, 19200)) {
Serial.println("FPC1020A not found");
while (1) delay(1);
}
M5.Display.fillRect(0, 0, 320, 240, WHITE);
M5.Display.println("Finger Unit TEST");
finger.delAllFinger();
M5.Display.println("All ID have been deleted");
}
void loop() {
while(id_input){
M5.Display.fillScreen(WHITE);
M5.Display.println("Please logic your finger");
if(add_user_process(1, 1)){
Serial.println("add user success");
M5.Display.println("add user success");
id_input = 0;
}
}
delay(2000);
while(id_Verification){
M5.Display.fillScreen(WHITE);
M5.Display.setCursor(0, 0);
M5.Display.printf("User ID Verification:\r\n");
uint8_t res = finger.available();
if (res == ACK_SUCCESS){
M5.Display.print("Success \r");
Serial.println("Success");
M5.Display.print("User ID: ");
Serial.print("User ID: ");
M5.Display.println(finger.getFingerID());
Serial.println(finger.getFingerID());
id_Verification = 0;
}
delay(2000);
}
while(id_delete){
uint8_t res2 = finger.available();
M5.Display.printf("Put your finger on the sensor again can delete all id\n");
if (res2 == ACK_SUCCESS){
finger.delAllFinger();
M5.Display.println("All ID have been deleted");
Serial.println("All ID have been deleted");
id_delete = 0;
}
delay(2000);
}
}
bool add_user_process(uint8_t id, uint8_t permission) {
M5.Display.fillRect(0, 0, 320, 240, WHITE);
M5.Display.setCursor(0, 0);
M5.Display.println("add finger process:");
M5.Display.println("put your finger on the sensor");
for (uint8_t i = 0; i < 6; i++) {
while (!finger.addFinger(id, permission, i)) {
Serial.printf("Finger ID: %d Finger Record:%d error\r\n", id, i);
Serial.println("Retry...");
delay(1000);
};
M5.Display.printf("add finger count : %d/6\r\n", i + 1);
Serial.printf("Finger ID: %d Finger Record:%d ok\r\n", id, i);
}
return true;
}
Download Mode: Different devices require entering download mode before programming. This process may vary depending on the main controller. For specific instructions, please refer to the device programming tutorial list at the bottom of the Arduino IDE Getting Started Guide page.
For CoreS3: Press and hold the reset button (approximately 2 seconds) until the internal green LED lights up, then release. The device will now enter download mode and is ready for programming.
add user success
will be displayed.
Success User ID: 1
indicating successful recognition.
All ID have been deleted
will be displayed.