alarm_guy1
Posts: 35
Joined: Thu Aug 16, 2012 10:04 pm

gpio to run python script

Sun Nov 19, 2017 7:16 pm

Hi i am looking for a python script to that will run a 2nd script when a button is pressed i.e. across gpio 18 any help cheers

B.Goode
Posts: 4689
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: gpio to run python script

Sun Nov 19, 2017 9:11 pm

The gpiozero Python library module contains a simple example of how to call a function in response to a button press. Maybe the function to be called could be the second script?

https://gpiozero.readthedocs.io/en/stab ... tml#button

alarm_guy1
Posts: 35
Joined: Thu Aug 16, 2012 10:04 pm

Re: gpio to run python script

Sun Nov 19, 2017 9:15 pm

thankyou will take a look

internsrus
Posts: 30
Joined: Fri Jul 21, 2017 2:14 am

Re: gpio to run python script

Mon Nov 20, 2017 1:47 am

Do you want/need to use a hardware button or would you consider using a tkinter frame with a software button? The tkinter frame's code could be incorporated into what would otherwise be the 'second' python script's definitions if that would suit. We have such a script (ssr.py) located in home/pi/Desktop that is invoked in terminal by:-
cd Desktop
python3 ssr.py

alarm_guy1
Posts: 35
Joined: Thu Aug 16, 2012 10:04 pm

Re: gpio to run python script

Mon Nov 20, 2017 6:43 am

Unfortunately this project requires a hardware button
Cheers

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 53 guests