Python Forum

Full Version: GPIO Bug?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am hoping someone can me tell why the following line of code causes the program to freeze up (stop exciting).

# Tell the controller to execute the task GPIO.output(Run_Pin, True ) 
Here is the included code

import RPi.GPIO as GPIO from tkinter import * from tkinter import _setit
Here is the GPIO setup code

#Initize the GPIO pins GPIO.setmode(GPIO.BCM) GPIO.setup(BUZZER_Pin, GPIO.OUT) GPIO.setup(IntensitySelect_Pins, GPIO.OUT) GPIO.setup(Ready_LED_Pin, GPIO.OUT) GPIO.setup(PWR_LED_Pin, GPIO.OUT) GPIO.setup(PUSH_BUTTON_Pin, GPIO.IN) GPIO.setup(Busy_Pin, GPIO.IN) GPIO.setup(Run_Pin, GPIO.OUT) GPIO.setup(DIR_Pin , GPIO.OUT) GPIO.setup(Abort_Pin, GPIO.OUT) 
Thank you for sharing your wisdom.
Is this only partial code?
The example does not initialize tkinter.
Yes, this is just a partial code of the entire script, which is over 1500 lines of code. This is the very first line that's not a part of the GUI.

As for the initialize of tkinter, is apart of the GUI interface. I did not write, but a friend wrote for me. I do not think the problem is in the GUI code, because the user interface works.The GUI code is about 80% of the code.

If you want to see the entire sketch here is a Dopbox link >>https://www.dropbox.com/scl/fi/nmfxv089x...fp0gc&dl=0 The problem is at line 179.
I Itracked the problem to the GPIO code. commenting out the GPIO code the program's GUI works great without any problems.
It may all these while loops with sleep in them.
sleep will hold up tkinters loop
What kind of device is this running on? If the code hangs as soon as you try a GPIO command my guess is the device is not connected or configured correctly.
The problem was a while loop waiting for a GPIO pin to be high. I am testing the Raspberry Python code while not connected to the controller, so that pin was floating causing the while loop to never exist.

Again I thank you for sharing your wisdom with me. Big Grin Big Grin Big Grin