Adding sensor handling: ISR and main function.