0

I am working with Raspberry Pi 4 and using python for some project.

The sample code is as below:

while True:
     if( GPIO.input(a)==GPIO.LOW):
          if __name == '__main__':
             try:
               #Running multiple threads
             except KeyboardIntrupt:
                pi.stop()
     if( GPIO.input(b)==GPIO.LOW):
          if __name == '__main__':
             try:
               #Running multiple threads
             except KeyboardIntrupt:
                pi.stop()
     if( GPIO.input(c)==GPIO.LOW):
          if __name == '__main__':
             try:
               #Running  multiple threads
             except KeyboardIntrupt:
                pi.stop()

The above written code is just an example of what am doing in my real code.

So in while loop their are multiple if else that runs based on PIN status (GPIO pin LOW). Problem is that once one pin gets low it enters in one IF but never comes out of it even after pin gets high and ignores all other if cases.

Is their any way to execute these if conditions continuously based on PIN status.

  • Only one pin gets LOW at one time. Multiple pins does not have Low state

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.