Added code to implement state-machines. Added buttons and everything from the rotation experiment