Henry_Best:
No. You can't have two devices trying to drive a piece of wire simultaneously.
That's not quite what I meant. If I tell the IDE to upload to the Mega (in Boards), will it ignore the Uno and just upload to the Mega and vice versa? As I said, it seems unlikely. But I've put in a DPDT switch now and I'll test it tomorrow, after I've reassembled the box.
[/quote]
It might pop up some annoying dialogs about serial ports or something, I haven't tried it.
OTOH you could open two separate IDEs and switch between them when you throw your switch. That will probably work better.
This raises a question: Why do you need to use a single USB cable? Why not two?