Three Sketches into One - No Worky

Greetings one and all. I am somewhat new to Arduino. I have dabbled with C/C++ a little, but I am by no means a skilled C++ programmer by any measure. But recently, I began fiddling around with an Arduino Uno, SD Card Shield, 16x2 Serial LCD, and a Real Time Clock (RTC) Module.

I was able to get each component’s sketch; i.e., SD Card Shield, 16x2 Serial LCD, and RTC Module, working properly as individual things, but when I attempted to integrate all three into one sketch I was not successful. I likely have a few to several silly mistakes in the sketch that is hanging it up. Here’s what it’s suppose to do.

Press one of two buttons and one of two LEDs will flash a few times. Then the LCD will get updated with text depending on which button was pressed, then the date/time will get logged to the CD card with a couple details appended to each data/time entry. When the logging event happens another LED flashes to indicate writing. Ultimately, this is a data logger that will record how many people or calls a person gets over time. Later the SD card can be removed and its data examined by importing it into Excel.

I have been trying to figure out the issue with the sketch for two days. Any suggestions would be greatly appreciated. The sketch is attached.

Phone-Person_20151221.ino (9.2 KB)

that is hanging it up.

Any more specific clues? How do you know it is hanging up?

  • There are a bunch of delay()s in the program that can be an issue if you expect real time response, or not if you don’t.
  • You are looking for the level in the switch (ie, ON) rather than a transition tat tells you that the switch has transitioned (ie, from OFF to ON).
  • If you are not using code that is commented out, then remove it as it makes it more confusing for others who are not familiar with it.
  • Have you checked that there are no conflicts in I/O between all the differnt bits of hardware you are using? I can’t find any, but I spent 2 minutes on the code.

pcitizen: I was not successful.

Do you just tell your garage mechanic that you tried to drive your car but you were not successful? That doesn't tell us anything about your problem or its symptoms.

What is it not doing that it should? What is it doing that it shouldn't? I couldn't get it to compile, but maybe that's because I may not have the required libraries installed.

pcitizen: I was able to get each component's sketch; i.e., SD Card Shield, 16x2 Serial LCD, and RTC Module, working properly as individual things, but when I attempted to integrate all three into one sketch I was not successful.

I suggest you go back to the three separate sketches and just integrate two of them. When that works properly then try adding the third.

That will make it much simpler for you to see possible problems and for us to help you.

This Simple Merge Demo may be helpful.

...R

Good questions or comments one and all. I should have said it will not compile. I have spent about 16 hours studying it and reviewing various web sites about these and other issues. After the merge it had a mess of compile issues. I fixed most, but these are still giving me trouble.

Phone-Person_20151221.ino: In function 'void updateDisplay(String)': Phone-Person_20151221.ino:161:29: error: no matching function for call to 'SoftwareSerial::write(String&)'

Phone-Person_20151221.ino: In function 'void logToSDCard(String)' Phone-Person_20151221.ino:173:25: error: no match for call to '(File) (StringSumHelper&)'

but these are still giving me trouble.

So, stop using Strings.

pcitizen: Phone-Person_20151221.ino: In function 'void updateDisplay(String)': Phone-Person_20151221.ino:161:29: error: no matching function for call to 'SoftwareSerial::write(String&)'

write is for sending raw bytes. For sending a string or a String you want to use print or println.