Example Code for Arduino-Query Module Baud Rate

Hardware Preparation

  • DFRduino Leonardo (or similar) x 1
  • Capacitive Fingerprint Sensor - UART (FPC Connector) × 1
  • DuPont Wires

Software Preparation

Wiring Diagram

 Wiring Diagram

Sample Code

The module's baud rate is 115200 by default. You can use the following codes to query if you don't know its buad rate (the buad rate will not be restored to the default when the module is power off).

/*
**Steps:**
1. Connect WiFit to “FireBeetle ESP32”, WiFi password: 12345678
2. Access the website: http://192.168.4.1/ON to turn on the LED. Enter http://192.168.4.1/OFF to turn off the LED.
3. Click **here** to control the brightness of LED.
*/

#include 
#include 
#include 

#define myLED 21 //Set pin 21 to the LED pin 
// Set WIFI name and password 
const char *ssid = "FireBeetle ESP32";//WIFI name 
const char *password = "12345678";//password

WiFiServer server(80);//Port 80 is the default web server port 


void setup() {
  pinMode(myLED, OUTPUT);

  Serial.begin(115200);
  Serial.println();
  Serial.println("Configuring access point...");

  //Delete password if you want an open network.
  WiFi.softAP(ssid, password);
  IPAddress myIP = WiFi.softAPIP();
  Serial.print("AP IP address: ");
  Serial.println(myIP);
  server.begin();

  Serial.println("Server started");
}

void loop() {
  WiFiClient client = server.available();   // Detect waiting for connection...

  if (client) {                             // Connection detecting 
    Serial.println("New Client.");
    String currentLine = "";                // Create a String variable to store data 
    while (client.connected()) {            // loop when keep connecting
      if (client.available()) {             // Detect is there is data on the connection
        char c = client.read();             // Read the received data 
        //Serial.write(c);                    // Print on serial monitor 
        if (c == '\n') {                    // If an newline character  is read

          //Use newline character to indicate the end
          if (currentLine.length() == 0) {
            client.println("HTTP/1.1 200 OK");
            client.println("Content-type:text/html");
            client.println();
             //Connect character with here 
            client.print("Click here to turn ON the LED.
");
            client.print("Click here to turn OFF the LED.
");

            // empty line in a HTTP response
            client.println();
            // Break out of a loop 
            break;
          } else {    // Clear cached data in variable if there is one newline character 
            currentLine = "";
          }
        } else if (c != '\r') {  // If characters except Carriage Return is obtained
          currentLine += c;      // Add the obtained character to end of the variable
        }

        // Check if /ON or /OFF is obtained 
        if (currentLine.endsWith("/ON")) {
          digitalWrite(myLED, HIGH);               //Turn on LED when /ON is obtained 
        }
        if (currentLine.endsWith("/OFF")) {
          digitalWrite(myLED, LOW);                //Turn on LED when /OFF is obtained 
        }
      }
    }
    // disconnect
    client.stop();
    Serial.println("Client Disconnected.");
  }
}

Result

Result