Electron Kernel is an Arduino framework that helps you to write multi-mode and task sketches. It helps you to organize your functions, tasks and modes of operation.
Download Electron Kernel library here and unzip into your Arduino library directory.
By default, Kernel is listening to Serial for changing mode. All you need to do is open Serial monitor and type 0, 1 or 2 to change the mode!!
The Kernel allows you to use different ways to change the operation mode using buttons / interruptions or you can create your own function for that.