Python Forum
How to make an input trigger the output once no matter how long input is high
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to make an input trigger the output once no matter how long input is high
#1
I have a python code that plays a sound when I push a button, but if I hold the button, it keeps playing the sound, which I dont want.

So what line would I add in the code to make it that if I hold the button high, it will only send one output until i release the button and press it again.
Reply
#2
I'm not a Raspberry-Pi Guy, but that's a Broadcom MCU

so I think that if you:
  • set a GPIO as input
  • write 1 to the same GPIO port
  • Set the GPIO as output
it will write the value sent when it ws an input, and latch it

No Guarantee, but give it a go
Reply
#3
(Feb-04-2018, 10:28 PM)Larz60+ Wrote: I'm not a Raspberry-Pi Guy, but that's a Broadcom MCU

so I think that if you:
  • set a GPIO as input
  • write 1 to the same GPIO port
  • Set the GPIO as output
it will write the value sent when it ws an input, and latch it

No Guarantee, but give it a go

Ok, how do i do that. I know nothing about coding in python, or coding in general.
Reply
#4
Since I don't know the pi commands, I can only guess, so I will refer you to: https://makezine.com/projects/tutorial-r...nd-python/
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Waiting for input from serial port, then move on KenHorse 3 1,008 Apr-17-2024, 07:21 AM
Last Post: DeaD_EyE
  Help with to check an Input list data with a data read from an external source sacharyya 3 403 Mar-09-2024, 12:33 PM
Last Post: Pedroski55
  difference between forms of input a list to function akbarza 6 1,022 Feb-21-2024, 08:02 PM
Last Post: bterwijn
  pyaudio seems to randomly halt input. elpidiovaldez5 2 362 Jan-22-2024, 09:07 AM
Last Post: elpidiovaldez5
  Receive Input on Same Line? johnywhy 8 704 Jan-16-2024, 03:45 AM
Last Post: johnywhy
  manually input data jpatierno 0 340 Nov-10-2023, 02:32 AM
Last Post: jpatierno
  Using string input for boolean tronic72 3 687 Nov-01-2023, 07:48 AM
Last Post: Gribouillis
  problem in using input command akbarza 4 1,106 Oct-19-2023, 03:27 PM
Last Post: popejose
  problem in entering address of a file in input akbarza 0 649 Oct-18-2023, 08:16 AM
Last Post: akbarza
  Input network device connection info from data file edroche3rd 6 1,004 Oct-12-2023, 02:18 AM
Last Post: edroche3rd

Forum Jump:

User Panel Messages

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