Uploading different sketches with Arduino

Hey,

I would like to change different sketches on an Arduino with a switch. How can I do that? I thought about uploading different .hex files on an arduino and upload these sketches via serial connection to the actual arduino on which I want to change.

Any recommendations?

Thanks in advance

Basically you can't.

You acheave the same effect by writing your sjpketch with two functions then in the loop function you look at the switch and decide what one of the two functions to call.

Here is a method I use – for purpose to cut and paste code from a different application. Download the first sketch, use “new tab” and add the second sketch to your IDE. Utilize “comment/ uncomment” menu to stop the compiler from compiling the unwanted sketch. Than use “comment/ uncomment” menu to alternate between sketches. For your purpose it would be “long way around the barn” , not just simple switch, for me, it lets me do my cut and paste just fine.

Cheers Vaclav