Page 1 of 1

Power Off Button Interupt

Posted: Mon Apr 23, 2018 3:57 pm
by OldPCGuy
I have a headless PiZero and off button that works with code that loops and polls. I would like to use the interrupt method. The intent is to have the button press first close a CSV file then shutdown the Pi.

As a beginner/novice I don't understand where the try: loop shown in the online examples resides relative the other code and functions. Is it in the function and def section, separate file, or somewhere else?

Re: Power Off Button Interupt

Posted: Tue Apr 24, 2018 1:22 am
by Paul Hutch
Links to the online examples you mention will help others give advice.