I am pretty new to the Arduino and haven't done C/C++ programming in years so I need help.
I have a sketch that I writing to handle keypad input and output text via USB Serial to a computer.
I am having problems with what I would call flaky operation, but I think it has to do with my programming. Actually, I think it specifically has to do with the way the variables are handled because the changes that make it work or not are sometimes addition of comments or commenting of debugging statements to remove them or reinstate them. Perhaps it's terminiators for the arrays, but I can't seem to get my head around it.
I have attached Monitor.pde with my sketch. Any help will be appreciated!
The specific behavior I see is:
- the call to RTC.now() seem to return nothing. When I attempt to use the output it is blank "0/0/2000 00:00"
-- When this happens, I have been able to get the date back by adding a call to Serial.print("anything");. Then I comment it out and the date will stay. I make other changes someplace else it the code that has absolutely nothing to do with the clock and I lose it again. - in the method endProcessing() the code will call printTicketLines(), but it never returns. printTicketLines() is used several times in the program and works fine everytime except when called from endProcessing(). I have added debug statements into printTicketLines() and it gets to "tag2" but does not reach "tag3". Further troubleshooting indicates it reaches the line "TicketLine += line[8];" and does not proceed any further.
-- This one is similar in that adding debug statements or commenting them will make it complete through "Finished" or not. It's never a consistent behavior.
I'm thinking it could be something with the arrays. Maybe I overflow the arrays somehow? A prime example is how I just removed a 5 line block of comments and it started working again. Why? It was just comments.
Monitor.pde (19.2 KB)