How to control startup with joystick on sense hat

139 Views Asked by At

We are trying to write a code that starts raspberry pi when you hit the joystick of the sense hat.

Code that acknowledges when joy stick is pressed

from sense_hat import SenseHat
sense = SenseHat()
while True: 
    for event in sense.stick.get_events():
        print(event.direction, event.action

outputs "middle pressed middle released"

Now I need code that when I press middle and release it starts up the raspberry pi or more importantly turns it off.

0

There are 0 best solutions below