Posts: 82
Joined: Mon Jan 02, 2017 4:53 pm
Location: Detroit Michigan

Power Off Button Interupt

Mon Apr 23, 2018 3:57 pm

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?

Paul Hutch
Posts: 384
Joined: Fri Aug 25, 2017 2:58 pm
Location: Blackstone River Valley, MA, USA
Contact: Website

Re: Power Off Button Interupt

Tue Apr 24, 2018 1:22 am

Links to the online examples you mention will help others give advice.

Return to “Python”