#include <NewSoftSerial.h>
byte query[24] = {
0x55, 0xAA, 0x50, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x01};
#define rxPin 2
#define txPin 3
NewSoftSerial fingerprint( rxPin, txPin );
void setup() {
Serial.begin(115200);
fingerprint.begin(9600);
}
byte val;
int i ;
void loop() {
for (i=0 ; i<24 ; i++){
fingerprint.write(query[i]) ;
}
while(fingerprint.available()>0){
val=fingerprint.read();
Serial.print(val, HEX);
Serial.print(" ");
}
delay(1000);
Serial.println("--");
}
I have replaced
for (i=0 ; i<24 ; i++){
fingerprint.print(query[i]) ;
}
with
for (i=0 ; i<24 ; i++){
fingerprint.write(query[i]) ;
}
fingerprint does not respond
with
for (i=0 ; i<24 ; i++){
fingerprint.print(query[i],BYTE) ;
}
fingerprint does not respond
why ?