OK, after a sleep and a cool-down, (sulk ), I decided that I wanted to finish what I started.
I’ve solved the last of the problems and got it working well now.
This time I altered the sketch’s compiled size ‘sketchLength’ at the top of “Copier.ino”, to reflect my compilation.
It’s still best if anyone testing this sketch does it immediately before use. The compiled size is likely to vary depending on the IDE/compiler version.
For me it’s now 4142 bytes, compiling (for UNO) with IDE V1.6.5.
(This is also mentioned in the comments at the beginning of both files.)
I added a few extra comments to the files, including connection details at the beginning of “BlinkVirus.ino”.
Also changed all instances of “Serial.print(xxxx,BYTE)” to “Serial.print((char)xxxx)”, instead of “Serial.write(xxxx)”.
The latter worked OK, but used more flash memory. (4228 bytes vs 4142 bytes)
Every bit counts in these little beasts.
To test, I first uploaded a small sketch to the target board that simply turned on the onboard LED, so I could see when things were happening. (The LED initially goes out when the source board connects, then it blinks continuously when the process is complete.)
After pressing the ‘Trigger’ button connected to the source board, it takes a second or two to complete the copy to the target board, then the source board’s LED starts to blink.
After a further 3 or 4 seconds, the target board’s LED begins to blink as well, synchronised to the source board’s LED.
I have no idea if this will work with other boards. It was originally written for a UNO, but chances are that at the very least, other '328P-based boards will be OK.
I’ve attached the final, tested and working, version of the project.
@fkeel, I hope you find it useful, since you’re the one that actually started the thread.
BlinkVirus.zip (3.83 KB)