Python Forum
Halting if command if gpio triggered event triggered
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Halting if command if gpio triggered event triggered
#2
OK I did some playing around and apparently I have to add a nested if statement with a break that calls back to detech the button press on the relevant gpio pin.

if keyboard.is_pressed('f'):
kit.servo[5].angle=10
print("f is pressed")
for I in range (3300):
  if button13.is_pressed:
    i = 3300
    break
  kit1.stepper1.onestep(direction=stepper.BACKWARD, style=stepper.DOUBLE)
if keyboard.is_pressed('b'):
kit.servo[5].angle=110
print("b is pressed")
for I in range (3300):
  if button12.is_pressed:
    i = 3300
    break
  kit1.stepper1.onestep(direction=stepper.FORWARD, style=stepper.DOUBLE)
The thing I have to account for is if the system starts up bound at the edge of travel with GPIO activated at either end.
Reply


Messages In This Thread
RE: Halting if command if gpio triggered event triggered - by knoxvilles_joker - Jun-13-2021, 05:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  GPIO Bug? Rchrd 6 1,306 Nov-17-2024, 10:46 PM
Last Post: Rchrd
  function return boolean based on GPIO pin reading caslor 2 2,189 Feb-04-2023, 12:30 PM
Last Post: caslor
  class Update input (Gpio pin raspberry pi) caslor 2 1,862 Jan-30-2023, 08:05 PM
Last Post: caslor
  Webhook, post_data, GPIO partial changes DigitalID 2 2,043 Nov-10-2022, 09:50 PM
Last Post: deanhystad
  How would I use Watchdog to get triggered when DVD is inserted? Daring_T 12 7,514 Aug-17-2021, 01:49 PM
Last Post: Daring_T
  Seemingly unstable GPIO output while executing from RetroPie LouF 6 5,991 Feb-19-2021, 06:29 AM
Last Post: LouF
  Process halting JarredAwesome 0 2,193 Dec-24-2020, 11:46 PM
Last Post: JarredAwesome
  Picture changing triggered by GPIO q_nerk 2 3,540 Dec-14-2020, 03:32 PM
Last Post: DeaD_EyE
  GPIO high if network IP has good ping duckredbeard 3 3,311 Oct-12-2020, 10:41 PM
Last Post: bowlofred
  raspberry pi tank gpio help jatgm1 1 3,482 May-06-2020, 09:00 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020