user36853: I have a FPC1020am that work perfectly with arduino and a ESP8266 D1 Mini V2 NodeMcu 4MB Lua that can connect to server.
How can I connect the FPC1020 direcetly to ESP8266 D1 Mini to scan finger and send matched id to server?
here is my code and error:
#include <NewSoftSerial.h>
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <FPC1020.h>


extern unsigned char l_ucFPID;
extern unsigned char rBuf[192];  //Receive return data
#define sw_serial_rx_pin 2 //  Connect this pin to TX on the FPC1020
#define sw_serial_tx_pin 3 //  Connect this pin to RX on the FPC1020

const char* ssid = "-------";
const char* password = "-------";

const char* host = "-------";
String url = "-------?id=";

NewSoftSerial swSerial(sw_serial_rx_pin, sw_serial_tx_pin); // Fingerprint serial (RX, TX)
FPC1020 Finger(&swSerial);

void setup() {
  Serial.begin(115200);
  Serial.print("connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  pinMode(4, INPUT);
}

void loop() {
  Serial.println("Please put your finger on the Sensor.");
  while(Serial.available()<=0);

  if( Finger.Search()){
    Serial.print("Success, your User ID is: "); 
    url = "-------?id=" + l_ucFPID;
    Serial.println( l_ucFPID, DEC);

    WiFiClient client;
    if (!client.connect(host, 80)) {
      Serial.println("connection failed");
      return;
    }

    client.print(String("GET ") + url + " HTTP/1.1\r\n" +
                 "Host: " + host + "\r\n" +
                 "User-Agent: BuildFailureDetectorESP8266\r\n" +
                 "Connection: close\r\n\r\n");

    String line = "";
    while (client.connected()) {
      line = client.readString();
    }

    Serial.println(line);    

  }
  else {
    Serial.println("Failed, please try again.");
  }
}

And the error is:
C:\Program Files (x86)\Arduino\libraries\NewSoftSerial\NewSoftSerial.cpp:41:27: fatal error: avr/interrupt.h: No such file or directory

 #include <avr/interrupt.h>
                           ^
compilation terminated.

exit status 1
Error compiling for board WeMos D1 R2 & mini.


user10394: I have never tried this, but a D1 Mini has 2.5 serial ports.

The Tx and Rx pins are Serial0. 
Digital pin 4 is TX1 - There appears to be no RX pin. 
D7 and D8 are Rx2 and Tx2.

So rather than using SoftwareSerial or NewSoftwareSerial try using Serial2.  It might work.

36853: <p>I have a <a href="http://www.shenzhen2u.com/FPC1020-Fingerprint-touch-sensor-kit" rel="nofollow noreferrer">FPC1020am</a> that work perfectly with arduino and a <a href="https://www.ebay.co.uk/i/391803724654?chn=ps&amp;dispItem=1&amp;adgroupid=41767405657&amp;rlsatarget=pla-327666159789&amp;abcId=1129006&amp;adtype=pla&amp;merchantid=7275934&amp;poi=&amp;googleloc=2826&amp;device=c&amp;campaignid=861364981&amp;crdt=0" rel="nofollow noreferrer">ESP8266 D1 Mini V2 NodeMcu 4MB Lua</a> that can connect to server.</p>

<p>How can I connect the <strong>FPC1020</strong> direcetly to <strong>ESP8266 D1 Mini</strong> to scan finger and send matched id to server?</p>

<p>here is my code and error:</p>

<pre><code>#include &lt;NewSoftSerial.h&gt;
#include &lt;ESP8266WiFi.h&gt;
#include &lt;WiFiClientSecure.h&gt;
#include &lt;FPC1020.h&gt;


extern unsigned char l_ucFPID;
extern unsigned char rBuf[192];  //Receive return data
#define sw_serial_rx_pin 2 //  Connect this pin to TX on the FPC1020
#define sw_serial_tx_pin 3 //  Connect this pin to RX on the FPC1020

const char* ssid = "-------";
const char* password = "-------";

const char* host = "-------";
String url = "-------?id=";

NewSoftSerial swSerial(sw_serial_rx_pin, sw_serial_tx_pin); // Fingerprint serial (RX, TX)
FPC1020 Finger(&amp;swSerial);

void setup() {
  Serial.begin(115200);
  Serial.print("connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  pinMode(4, INPUT);
}

void loop() {
  Serial.println("Please put your finger on the Sensor.");
  while(Serial.available()&lt;=0);

  if( Finger.Search()){
    Serial.print("Success, your User ID is: "); 
    url = "-------?id=" + l_ucFPID;
    Serial.println( l_ucFPID, DEC);

    WiFiClient client;
    if (!client.connect(host, 80)) {
      Serial.println("connection failed");
      return;
    }

    client.print(String("GET ") + url + " HTTP/1.1\r\n" +
                 "Host: " + host + "\r\n" +
                 "User-Agent: BuildFailureDetectorESP8266\r\n" +
                 "Connection: close\r\n\r\n");

    String line = "";
    while (client.connected()) {
      line = client.readString();
    }

    Serial.println(line);    

  }
  else {
    Serial.println("Failed, please try again.");
  }
}
</code></pre>

<p>And the error is:</p>

<pre><code>C:\Program Files (x86)\Arduino\libraries\NewSoftSerial\NewSoftSerial.cpp:41:27: fatal error: avr/interrupt.h: No such file or directory

 #include &lt;avr/interrupt.h&gt;
                           ^
compilation terminated.

exit status 1
Error compiling for board WeMos D1 R2 &amp; mini.
</code></pre>
 10394: <p>I have never tried this, but a D1 Mini has 2.5 serial ports.</p>

<ul>
<li>The Tx and Rx pins are Serial0. </li>
<li>Digital pin 4 is TX1 - There appears to be no RX pin. </li>
<li>D7 and D8 are Rx2 and Tx2.</li>
</ul>

<p>So rather than using SoftwareSerial or NewSoftwareSerial try using Serial2.  It might work.</p>
