Go Down

Topic: fingerprint scanner communication through uart (Read 14209 times) previous topic - next topic

drab

i am using a texas insturments fingerprint eval board to activate a door lock. it communiocates through rx and tx. i have yet to find code for this bugger online. im working on some code for this thing to comunicate with uno this is what i have so far

Code: [Select]
#include <NewSoftSerial.h>
#include <string.h>
char incoming_char=0;
NewSoftSerial mySerial(2, 3);

void setup() 
{
  Serial.begin(9600);
  fdk.begin(9600);

}

void loop()
{
  if (fdk.available() >0)
  {
    incoming_char=fdk.read();
    Serial.print(incoming_char);
  }
  if(Serial.available() >0)
  {
    incoming_char=Serial.read();
   
    fdk.print(incoming_char);
  }
}


it tells me that fdk is not declared in this scope in both set up and loop. any ideas on what im doing wrong here i know its somethin simple but help would be nice.

tgm1175

You've declared a serial port named mySerial.
But you're trying to use one named fdk.

Either replace all instances of 'fdk' with 'mySerial', or replace all instances of 'mySerial' with 'fdk'

Grumpy_Mike

Quote
it tells me that fdk is not declared in this scope in both set up and loop.

Yes it will, because it knows nothing about it. I think you need to replace:-
Code: [Select]
NewSoftSerial mySerial(2, 3);

with
NewSoftSerial fdk(2, 3);


drab

ok new question same sensor...when using that code after its fixed when i get a match from the scanner i get this in the serial monitor after adding ,HEX to the line Serial.print(incoming_char);

FFFFFFF5C0130EFFFFFFF5

how can i use this in the sketch to light a led or to trigger an event? i have tried making it a const int;  a char incoming_char=0; and tried to just say if fdk read = and cant get it to compile any of those ways any suggestions

AWOL

Quote
and cant get it to compile

You need to show us what "it" is

drab

Code: [Select]
#include <SoftwareSerial.h> 
#include <string.h>         
const int match = 5C0130E;     
SoftwareSerial fdk(2,3);   
const int led = 13;

void setup()
{
  //Initialize serial ports for communication.
  Serial.begin(9600);
  fdk.begin(9600);
  pinMode(led,OUTPUT);
}

void loop()
{
  if(fdk == match)
  {
    digitalWrite(led,HIGH);
  }
  else{
    digitalWrite(led,LOW);
  }
}

tgm1175

Take a look at: http://arduino.cc/en/Serial/read

Here's the general process flow:

1. Is there stuff in the serial port waiting to be read? " while (fdk.available() ) { ... stuff here ... }"
2. Stick that "stuff" into a buffer.  ( fdk.read() will read and return a single character )
3. You'll need a termination character to tell the sketch to stop looking for serial data.  (You could use 'F' if you wanted as per your example).
4. Once you've seen the termination character, you'll need to convert your buffer (which is a sequence of characters or digits in ascii) to its numerical equivalent.
5. Use itoa for this if the number is 16 bits.  Use strtoul if it's 32-bit. http://www.cplusplus.com/reference/clibrary/cstdlib/itoa/
6. Good luck

PaulS

Code: [Select]
  if(fdk == match)
Since fdk is an instance of SoftwareSerial and match is an int, how the heck do you ever expect them to be equal? Can I have some of what your smoking?
The art of getting good answers lies in asking good questions.

drab

paul you sure can marlboro golds.....ok now what i want to do is take the hex values im getting from the scanner, and set them up as an array so i can compare them...im lost on setting up the array is this a good start here and am i setting up the values properly

int myVals[5];
myVals[0]==FFFFFFF5C0130EFFFFFFF5;
a=myvals[0];

and im actually getting a expected constructor, destructor, or type conversion before == token do i have to convert this hex value to a int value to compare them using the int() conversion to compare them??
if this way of setting upp my array is wrong could someone please nudge me in the right direction..i read the pages on aray in refrence and am just a lil bit confused is all

AWOL

Code: [Select]
int myVals[5];
myVals[0]==FFFFFFF5C0130EFFFFFFF5;
a=myvals[0];

Ok, an "int" can store values in the range -32768 (0x8000) to +32767 (0x7FFF).
If the constant in the second expression were expressed correctly (hint) it would fall uncomfortably outside of that range.
So, no squeezing quarts into pint pots (is there a metric equivalent of that?).
Code: [Select]
0xFF 0xFF 0xFF 0xF5 0xC0 0x13 0x0E 0xFF 0xFF 0xFF 0xF5; looks to me to be at least eleven bytes of storage, so how about a byte array instead?

drab

Ok thx awol ill try that later on today and the hint and code u provided is that how it should be expressed correctly im not that good at arrays failed it big time in class lol it was the only part of programming i have trouble with for some stupid reason...

michael_x

Quote
it was the only part of programming i have trouble with


;) Well, perhaps Arduino might show you more parts   ...
Have fun, though


BTW: Are you dealing with this one: http://search.digikey.com/us/en/products/TMDXBDKFP5515/296-27452-ND/2295963  ?
( 80 USD  ??? )

drab

Yes michal i am howd u know and can you help

michael_x


Yes michal i am howd u know and can you help

Well I searched, as I saw such sensors embedded in laptops and thought it might be interesting, eventually.
And no, I cannot help with that sensor, sorry.
I'm astonished about the price, though. ( Too high to just give it a try for fun for me )

Let me know how many different codes a single finger produces, and how big theses codes are...
What's the chance to produce identical codes ?

Go Up