Python Forum
Can I Control loop with Keyboad key (start/stop)
Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can I Control loop with Keyboad key (start/stop)
#2
I am not positive but there should be something like getch() function. So you could say:

char = getch()

if (char == '1'):
  io.output(motor1_in1_pin, True)

if (char == '2'):
  io.output(motor1_in1_pin, False)
Then again I have never used a Raspberry Pi before.
Reply


Messages In This Thread
RE: Can I Control loop with Keyboad key (start/stop) - by Vysero - Jul-27-2018, 03:31 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Button to stop while loop from another script Absolutewind 5 983 Sep-25-2023, 11:20 PM
Last Post: deanhystad
  ''.join and start:stop:step notation for lists ringgeest11 2 2,476 Jun-24-2023, 06:09 AM
Last Post: ferdnyc
  get out of while loop and stop repeat Frankduc 11 3,084 Apr-26-2022, 10:09 PM
Last Post: deanhystad
  tkinter control break a while loop samtal 0 2,423 Apr-29-2021, 08:26 AM
Last Post: samtal
  Start loop from different points TheHolyPyGrenade 3 2,113 Apr-11-2021, 07:57 PM
Last Post: TheHolyPyGrenade
  Stop/continue While loop block Moris526 68 26,231 Mar-28-2021, 09:21 PM
Last Post: Larz60+
  while loop will not stop looping TheTechRobo 5 3,801 Apr-20-2020, 01:47 PM
Last Post: TheTechRobo
  Use Python to start/stop a server service via a webform? oakleaf2001 0 1,782 Apr-04-2020, 06:14 AM
Last Post: oakleaf2001
  start and stop omxlayer playback dezmob 2 4,801 Jan-27-2020, 09:43 AM
Last Post: dezmob
  how to stop and start a script for 30 seconds laspaul 9 7,777 Jan-16-2020, 02:13 PM
Last Post: laspaul

Forum Jump:

User Panel Messages

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