Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use Thread() ?
#4
No, what I am saying is that none of this code executes inside the thread.
    if led_off1==False and GPIO.input(senseur_Del2)==1:
                        thread = Thread(target=ent.delai, args=())   <-----maybe at the wrong place or stop at the wrong time
                        thread.start()
                        GPIO.output(DEL1,True)
                        time.sleep(.2)  # Not in a thread
                        GPIO.output(DEL1,False)
                        time.sleep(.2)  # Not in a thread
                        led_off2=True   # Should this be led_off1 == True?
                        sleep(.5)   # Not in  a thread
This may only be 0.9 seconds of delay, but it happens continuously as long as GPIO.input(senseur_Del1) == 1.

And you have a bunch of other waits that don't happen inside the thread.
Reply


Messages In This Thread
How to use Thread() ? - by Frankduc - May-10-2022, 05:42 PM
RE: How to use Thread() ? - by deanhystad - May-10-2022, 07:00 PM
RE: How to use Thread() ? - by Frankduc - May-10-2022, 07:11 PM
RE: How to use Thread() ? - by deanhystad - May-10-2022, 08:53 PM
RE: How to use Thread() ? - by Frankduc - May-10-2022, 09:53 PM
RE: How to use Thread() ? - by deanhystad - May-12-2022, 12:23 PM
RE: How to use Thread() ? - by deanhystad - May-13-2022, 07:06 PM
RE: How to use Thread() ? - by Frankduc - May-17-2022, 04:51 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Error SQLite objects created in a thread can only be used in that same thread. binhduonggttn 3 15,808 Jan-31-2020, 11:08 AM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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