Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GPIO Bug?
#1
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.
Thank you for sharing your wisdom
Reply
#2
Is this only partial code?
The example does not initialize tkinter.
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
Download my project scripts


Reply
#3
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.
Thank you for sharing your wisdom
Reply
#4
I Itracked the problem to the GPIO code. commenting out the GPIO code the program's GUI works great without any problems.
Thank you for sharing your wisdom
Reply
#5
It may all these while loops with sleep in them.
sleep will hold up tkinters loop
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
Download my project scripts


Reply
#6
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.
Reply
#7
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
Thank you for sharing your wisdom
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  function return boolean based on GPIO pin reading caslor 2 2,036 Feb-04-2023, 12:30 PM
Last Post: caslor
  class Update input (Gpio pin raspberry pi) caslor 2 1,694 Jan-30-2023, 08:05 PM
Last Post: caslor
  Webhook, post_data, GPIO partial changes DigitalID 2 1,898 Nov-10-2022, 09:50 PM
Last Post: deanhystad
  Seemingly unstable GPIO output while executing from RetroPie LouF 6 5,647 Feb-19-2021, 06:29 AM
Last Post: LouF
  Picture changing triggered by GPIO q_nerk 2 3,372 Dec-14-2020, 03:32 PM
Last Post: DeaD_EyE
  GPIO high if network IP has good ping duckredbeard 3 3,135 Oct-12-2020, 10:41 PM
Last Post: bowlofred
  raspberry pi tank gpio help jatgm1 1 3,296 May-06-2020, 09:00 PM
Last Post: Larz60+
  Where should I place GPIO.cleanup() shallanq 2 3,010 Apr-11-2020, 05:02 AM
Last Post: shallanq
  Orange PI Win steering LEDs connect to GPIO djmcg 0 1,980 Dec-27-2019, 08:26 AM
Last Post: djmcg
  GPIO time in HIGH LOW boris_za 1 2,930 Dec-07-2019, 01:48 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