-1

I have a raspberry pi and I was wondering if there was a way to interrupt a program using a GPIO pin? For example, the pi begins printing a long story but if i click a button and close the switch it will pause and turn on a led. I did some research but i could only find stuff for python 2 while I am using 3. Thank you any help is greatly appreciated. :D

Joe Van Wonderen
  • 37
  • 1
  • 2
  • 4
  • The differences between python 2 and 3 shouldn't be an issue - the same principles apply, and you can use the py2to3 tool to convert source first. – deets Aug 30 '15 at 11:29

1 Answers1

1

The RPi.GPIO library supports Python 3, so you can start by using that.

Assuming that your RPi board is one that uses GPIO 3, here is an example:

import RPi

RPi.GPIO.setmode(RPi.GPIO.BCM)

RPi.GPIO.output(3, RPi.GPIO.LOW)
bignose
  • 30,281
  • 14
  • 77
  • 110
  • 6
    It would improve the quality of your answer if you gave some sort of explanation of what you've written. Just providing the details you have may not be enough for some people to understand what to do or how to use it. – Nigel Ren Sep 04 '17 at 06:52