I should know how to do this but I have not played with my arduinos for some time and I seam to have forgot….. Well on with the question !!!!! …. I have a barcode scanner hooked up to my arduino and with this sketch it reads barcode's and prints the value to the screen . How do I get it to recognise a barcode that I have already put in the code Eg if barcode reads 1234567 Serial.println" barcode in database"

/*Barcode Scanner This code reads the input from a ps/2 keyboard or keyboard-like device (e.g. a barcode scanner), translates the scan-codes into numbers (only numbers from 0 to 9 can be used at the moment) It is nowhere near a complete implementation of the ps/2 protocol, but it should give you a starting point. mys .// Benjamin Maus( benjamin.maus <at> allesblinkt.com ) 2007 */

The dataRead() function gets one value, which is then used to determine what to store in buffer.

Once dataRead() returns a SCAN_ENTER, it is the value in buffer that needs to be compared to values in a list. Since buffer is a char array, and is NULL terminated, use strcmp() to compare buffer to known strings.

Where have you defined the names/values of the barcodes that you want to check the scanned on against? That is the (global) array that I called goodCards. If you have another name, we can use that instead.

Serial.print("goodMatch = ");Serial.println(goodMatch); // Will print index of good card in array// Reset the SCAN_BREAK state if the byte was a normal one if(dataValue != SCAN_BREAK){ breakActive = 0; } dataValue = 0; }

Serial.print("goodMatch = ");Serial.println(goodMatch); // Will print index of good card in array// Reset the SCAN_BREAK state if the byte was a normal one if(dataValue != SCAN_BREAK){ breakActive = 0; } dataValue = 0; }