Go Down

Topic: Serial Communication with fingerprint module (Read 913 times) previous topic - next topic

pracas

I'm trying to communicate with a fingerprint module

i need to send the following packets of data for a single command.

0x4D + 0x2A + 0x10

Now how do i actually send these using the arduino serial print function.

When i try to serial print with various options (HEX,etc) and monitor it using serial monitor i dont see these values getting printed in the serial monitor

serial.println(0x4D,HEX);

I would appreciate if someone can give me a sample code of how to communicate such data. I assume th '+' between the bytes means that i transmit byte after byte?

heres the user manual for the module i'm using.
http://www.4shared.com/file/80936462/78868372/_2__SM-630_USER_MANUAL.html
Be The Change...

Collin80

Quote
I'm trying to communicate with a fingerprint module

i need to send the following packets of data for a single command.

0x4D + 0x2A + 0x10

Now how do i actually send these using the arduino serial print function.

When i try to serial print with various options (HEX,etc) and monitor it using serial monitor i dont see these values getting printed in the serial monitor

serial.println(0x4D,HEX);

I would appreciate if someone can give me a sample code of how to communicate such data. I assume th '+' between the bytes means that i transmit byte after byte?

heres the user manual for the module i'm using.
http://www.4shared.com/file/80936462/78868372/_2__SM-630_USER_MANUAL.html


I actually already told you how to do this in your first topic (http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1232117916/3#3)

But, to reiterate, you need to use serial.print(0xVALUE, BYTE);

Also, don't use println use just print.

To send the byte sequence above to the fingerprint unit you would do this:

serial.print(0x4D, BYTE);
serial.print(0x2A, BYTE);
serial.print(0x10, BYTE);

In general, though, it's best to make #DEFINEs for each hex code so that things are more clear. For instance, let's say that 0x4D is always a start code and 0x2A means validate fingerprint. 0x10 could maybe mean only accept an administrator's print. So the defines might be:
#DEFINE StartByte 0x4D
#DEFINE CapturePrint 0x2A
#DEFINE Accept_Admin 0x10

And then the above serial output would instead be:
serial.print(StartByte, BYTE);
serial.print(CapturePrint, BYTE);
serial.print(Accept_Admin, BYTE);

This is more clear for when you read the code in the future. It's a lot easier to figure out what is going on.

Go Up