Pages: [1]   Go Down
Author Topic: Serial Communication with fingerprint module  (Read 873 times)
0 Members and 1 Guest are viewing this topic.
Chennai, India
Offline Offline
God Member
*****
Karma: 0
Posts: 752
Peace!!!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Be The Change...

Earth
Offline Offline
Sr. Member
****
Karma: 14
Posts: 326
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: