It’s nice when things come together. The MuxShield is now able to re-program up to 5 attached slaves and then act as multiplexer for serial output from each of them.
Here’s how it works in practice:
- Connect the MuxShield and plug a few slaves into it.
- Make sure the switch is set to “PROG”.
- Program a sample sketch for the slaves into it, e.g.:
- Connect to the MuxShield with a terminal:
(that’s 3x two lines of output, every 3 seconds)
- Sample output with the switch set to “RUN”:
- In the “RUN” position, programming changes the MuxShield code of the ATmega328 itself.
I often forgot to put the switch in the right position while developing the MuxShield code, but once that is done it should no longer be an issue. Since the slave code is for an ATmega168, sending it to the MuxShield with the switch set to “RUN” will fail (the 328 bootstrap rejects the 168 re-programming request).
Note that the MuxShield also makes a fine stand-alone re-flash unit: just connect a slave and press reset with the switch set to “PROG”. Here’s a MuxShield with 5 slaves, all trying to say “Hi!” at the same time:
Source code of the MuxShield sketch is available here.
Onwards – I now have the perfect tool to develop and test multiple JeeNodes!