Hello all --
I am working on a project using the following setup:
Arduino Uno
Mini Thermal Printer from Adafruit
LCD Shield Kit 16x2 from Adafruit
Neopixel Stick (8x1) from Adafruit
Fingerprint Sesor - made by Kookye (Adafruit was all out of theirs).
According to the Kookye website, I have to use Arduino IDE 1.0.6, so that is what I am using. It throws up lots of errors w/ 1.0.8. The library for it looks almost identical to the library for the Adafruit fingerprint sensor, but is a separate one downloaded from the Kookye website - the .zip is found on the instructions page for this sensor. It also uses nearly identical (but distinct) fingeprint enrollment software (also found on the previous page).
I am having two (seemingly related) issues. First I will describe the code for the project, and then the issue I am having, and then I will include the code.
This is how it should work:
On the first row, the LCD display shows a 16 digit number in base-5 which increments with every iteration of loop().
Because 5^16 is a massive number, and it is supposed to go through every value eventually, I am doing this by writing a simple class, which stores a 16 digit int array.
There is an increment function which takes a a digits-place as input. It goes to that place, increments, checks if it is equal to the base, and if so, rolls back to zero and calls the incrementation function on the next place over.
The display just shows this number on the first row. In order to get decent speed, I do not update all 16 digits on the display every iteration of the loop, but rather, the incrementation function within the ticker class also updates the lcd with just the digit that has changed each time the incrementation is called on some digit of the 16-digit number.
The fingerprint scanner is used to unlock the d-pad/select buttons on the LCD Shield. For now, all I want to do is make it so that when an authorized user presses "select" with their finger on the scanner, the thermal printer then prints out the current state of the base-5 counter, and the second row of the LCD just stores that value as the first continues to increment.
The 8-pixel neopixel stick just displays a chromatic encoding of the first 8-digits of the base-5 counter (it is trivial to extend it to the appropriate 16 one everything else is working).
I am having two separate (but seemingly related) issues.
Using code which does not make reference to the fingerprint scanner or the neopixel, everything works fine - I simply press the button and the thermal printer outputs the appropriate number.
If I add in the code for the arduino to verify a user using the fingerprint scanner, what happens is -
I press the button with my finger.
It successfully authorizes.
The printer correctly outputs the number.
Messages that I then print to the Serial monitor or the LCD appear fine.
Upon exiting the if statement which is a call to the fingerprint authorization function, and which contains the "print the current state" code, the arduino resets.
If I use the Neopixel but not the fingerprint scanner, the neopixel updates fine as long as I do not try to print.
As soon as I try to print, the printer successfully prints, but then the arduino freezes.
If I try to use the Neopixel and the fingerprint scanner, the arduino freezes when I press the button for the printer to output the state.
My research seems to suggest that this is some sort of memory issue.
The output of freeram within the control statement is always between 900 and 1100 depending on which parts I have activated. It does DECREASE before the fingerprint scanner call and after.
Any help would be appreciated. Am I simply running out of RAM? I've looked at the classes for the fingerprint functions and the counter incrementation functions and the LCD and I'm pretty sure there are no chances of memory leaks, or using massive amounts of memory - well I could see the fingerprint scanner using a lot of memory, but it crashes many lines after the fingerprint scanner function is called - really only when exiting the if-statement that it controls... Also, I don't get why the code would crash using just the printer and lcd shield and a single 8x1 neopixel stick. It seems like using the button to thermal print the current state should not all of a sudden crash everything, as it using the button to control printing works perfectly without the neopixel code activated...
Anyways, all the code I've written is in the next post. I'm also using the Adafruit LCD Shield library (a modification of the LiquidCrystal library, also includes the Wire.h and MCP libraries), the Adafruit Neopixel Library, and the Adafruit Thermal Printer library.
Thank you in advance for any help you may be able to offer.