arduino with fingerprint

hai. I kifli from Indonesia
I connect the microcontroller with a fingerprint cama-sm20
datasheet
Check connection to the microcontroller needs to send data to a fingerprint xx55 xx50 xx01 xx00 xx00 xxAA xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx50 xx01.
fingerprint will send a response xx55 xx50 xx01 xx04 xxAA xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx00 xx54 xx01

how to send commands from the microcontroller to the fingerprint.
please help
sorry if my english is not good

CAMA SM Series Manual new.pdf (847 KB)

Is this a serial, parallel, one-wire device?

If a serial device

int Ser2Finger={0x55,0x50,0x01, and so forth for all 24 items.

int ct;
for (ct=0, ct<24, ct++){
Serial.print(Ser2Finger[ct],BYTE);
}

This should do it, you can write multiple bytes:

byte Ser2Finger[]={0x55,0x50,0x01, ... };
...
     Serial.write(Ser2Finger, sizeof Ser2Finger);

I connect the serial
I make the program as follows:

#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.print(query[i]) ;
  }
  delay(50);
  while(fingerprint.available()>0){
    val=fingerprint.read();
    Serial.print(val, HEX);
    Serial.print(" ");
  }
  delay(1000);
  Serial.println("--");
}

but the fingerprint does not give any reply.
whether serial.print serial.write replaced with?

Moderator edit: [code][/code] tags added. (Nick Gammon)

Where’s the stuff PaulS and I sent you on this last night?

  for (i=0 ; i<24 ; i++){
    fingerprint.print(query [i] ) ;   <<< change this line
  }

Moderator edit: [code][/code] tags added. (Nick Gammon)

I have replaced

for (i=0 ; i<24 ; i++){
fingerprint.print(query*) ;*

  • }*
    with
    for (i=0 ; i<24 ; i++){
    _ fingerprint.print(query*,BYTE) ;_
    _
    }_
    fingerprint does not respond
    with
    for (i=0 ; i<24 ; i++){
    _ fingerprint.write(query) ;
    }*
    fingerprint does not respond
    why ? =(_

I can’t read that code if you don’t put it into code tags. It goes all italics, like.

Please edit your post, select the code, and put it between [code][/code] tags.

You can do that by hitting the # button above the posting area.

#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 ?

while(fingerprint.available()>0){
    val=fingerprint.read();
    Serial.print(val, HEX);
    Serial.print(" ");
  }

You are reading faster than the device can send.

http://www.gammon.com.au/serial