I am very much a newbie to the arduino code and have had a lot of assistance with my project so far.
I have now got a working code and it has worked perfectly with a borrowed Arduino Uno. However now I am testing myself I am using my Mega2560 board and the code won't upload. There is no error message the upload is just timing out. The RX/TX flashes as it begins to upload but then begins blinking every second and continues to say uploading.
Is it something to do with using a different board? The board is okay with other programs so can't see why this board should be any different to the uno i used previously.
Program is attached. (Ignore notes, had lots of debugging and a dodgy accelerometer.)
See that key up there, on the top row, just to the right of the ~? Bang it three times.
@PaulS, sometimes you can be very helpful and other times not. This is one of the "not" times.
An earlier post said that the bootloader treats "!!!" as something special which was preventing the OPs code from uploading. I had assumed from your earlier post that you were aware of this but chose not to explain the problem.
You know perfectly well that I know how to type three exclamation marks just as well as you do. I'm pretty sure you also know that I was asking how to get around the bootloader's treatment of "!!!". If you know, please tell us and also tell us if you don't know.
On the other hand you know that the "!!!" is not the problem preventing the OPs sketch from uploading but you are not prepared to share your knowledge with us.
I vaguely remember that there was an updated bootloader that fixed that stupid "!!!" bug, but that may have been wishful thinking. If the "!!!" is only used in a text literal then you can either break the literal up so you don't get three adjacent '!' characters in the code, or roll your eyes at yet another unnecessary Arduino gotcha and just use a different string such as "! ! !".
I had assumed from your earlier post that you were aware of this but chose not to explain the problem.
I was. I thought that the subtle hint I gave might have been enough to get the OP to remove the excessive punctuation, and see that the code that actually uploaded. I figured if that happened, then OP might actually search for previous mentions of the problem.
For too subtle a hint, I see. Oh, well.
You know perfectly well that I know how to type three exclamation marks just as well as you do.
I thought you did, which made the question strange.
I'm pretty sure you also know that I was asking how to get around the bootloader's treatment of "!!!". If you know, please tell us and also tell us if you don't know.
No, I didn't read that into your question. As far as I know, the only way to get the bootloader to not get hung up on the !!! is to not use !!! in the sketch. It simply isn't value added.
PaulS:
As far as I know, the only way to get the bootloader to not get hung up on the !!! is to not use !!! in the sketch. It simply isn't value added.
Thanks. I'll try to remember to avoid three exclamation marks.