Hi guys and girls
I'm currently busy with a project that receives phone calls, logs them, and sends reports to admin users via SMS. Admin users can also reset the values that are being logged via an SMS. I use a Seeeduino Stalker v2.3 and a GPRS Shield v1.4.
My problem is as follows:
Function sendTextMessage( char number, char messg ) sends an SMS containing messg as body to number. I use AT commands to achieve all this:
in: AT+CMGF=1\r <- "Please send a text message."
out: OK <- "Sure thing!"
in: AT + CMGS = "[number]"\r <- "Here's the number."
out: OK <- "Thanks!"
in: [messg] ctrl-z \r <- "The body..."
out: > [some gibberish] OK <- "Your message is sent"
There is no question of whether or not this works. I've been using it successfully for quite a while now. The problem is: the first 6 characters of number come out as gibberish chars when I run my sketch. In previous versions of this project I used an identical version of sendTextMessage() with no problems. In fact, I made no huge changes in the programs' overall structure between the two versions, which are both attached. I also attached a sample output, containing the gibberish in line 52. I manually added line numbers afterward.
Having encountered a similar problem before, I immediately assumed the problem was related to memory, so I made the standard changes: Moved any non-changing Strings to PROGMEM, put all misc strings in F(). I also got a little memory measurement function off of the forums, and I call it at places of interest. Finally I added Serial printouts at the beginnings and ends of all relevant functions, to look for crashes or weird behavior. (">functionName + date/time = beginnig of funtion, <functionName + date/time = end of function")
According to the memory function, I never get close to filling up the RAM. You'll see those numbers on the sample output(lines 31, 34, 38, 40, 41, 43, 45). Furthermore, all of the functions seem to be behaving themselves.
Please take a look. I know my code isn't super awesome. I am quite new to Arduino. Please tell me what steps I can take to further investigate and/or solve this problem. If it's a memory issue, please tell how you knew.
Please note that the previous version is quite stripped down, having no Serial outputs. For some reason I thought removing them would save memory. But the part of the program in question works perfectly, although there are other unrelated errors I'm fixing. The current version is also not perfected yet, with a few possible unrelated bugs.
Previous version: RemoteCallLoggerV1e1safe.ino
Current version: RemoteCallLoggerV1e2safe.ino