Ok, so I kind of started over, and compiled the sketch after every action I took, to check where the problem started. I didn't solve the mystery, but I might have learnt something new.
Before I can explain what exactly happened, the reader needs to understand how I'm structuring this program.
I have two separate sketches I copy from: one that contains all the code necessary for control over the onboard real time clock (RTC), and one containing all the code necessary for control over the GPRS Shield I'm using.
My main objective is to log the times the Shield receives calls, and use the Shield to send data via text message at a predetermined time.
For this I simply need to combine my two aforementioned sketches, and add a few bits and bobs.
So everything I'm doing kind of happens in two halves: GPRS and RTC.
For my own sanity's sake, I keep the two devices' code separate.
Also, the function gprsListen() is the only GPRS function called directly from void loop(), and it's location actually made a difference, see below.
In the first sketch I attached, the order of all the parts were as follows:
includes for both devices
#defines for RTC
variable declarations for GPRS
variable declarations for RTC
GPRS functions (including the function gprsListen)
RTC functions
setup
loop (calls the gprsListen() function and updates the time)
The above structure made the compiler go all stupid. Now for the new structure (attached file):
#includes for both devices
#defines for RTC
variable declarations for GPRS
variable declarations for RTC
RTC functions
GPRS functions
setup
loop (calls the gprsListen() function and updates the time)
gprsListen()
Ok, so there are 2 major changes, and 1 very weird thing:
change 1: I had to swap the GPRS and RTC function bundles
change 2: I had to put the gprsListen() function somewhere below setup. Anywhere above setup, and the compiler goes all stupid again.
Very weird thing: In void setup() there is a Serial.println(""); indicated with a comment. If you comment it out, the sketch still compiles. If you delete the command, or only the quotes, the compiler goes all stupid with the same error.
Remember, effectively there is almost no difference between the sketches. They contain all the same functions and variables, I just pasted them in different places.
I don't know what any of this means, maybe you guys do.
Thanks so far
RemoteCallLoggerV0.ino (12.8 KB)