Loading multiple sketches into Arduino

Arduino can only loading of 1 sketch at a time.

Can I combine multiple sketches as subroutines/functions into a larger sketch and invoke the appropriate subroutines from the "main program", for example:

  • single press to invoke subroutine/sketch 1,
  • double press to invoke subroutine/sketch 2
  • etc...

Sorry, I cant test it out at the moment as I am still waiting for my Arduino board to arrive ;D

Yes - provided that the compiled size of the code doesn't exceed the space on the chip (30K for the ATMega328 w/ standard bootloader, 14K for the ATMega168 w/ standard bootloader), you should be OK.

BTW - I say "with standard bootloader" because it is possible to gain back some or all of the 2K used by a standard bootloader; this can be done by using an "optimized" bootloader (I think the smallest one can make it is 512 bytes due to hardware limitations) - which you need to "burn" onto the chip using an AVR ISP programmer.

Alternatively (since if you can do the above with an AVR ISP programmer, you would have the skills needed), you can simply burn the compiled hex/binary code onto the ATMega using such a programmer, and bypass the need for a bootloader (giving you access to the additional memory normally taken up by the bootloader).