Program running on the raspberry pi handling all the events