Reputation: 1
I've made a RC car and recently I just got a kit that has all the stuff I need to add collision warnings, the problem is, is that it blocks codes and it will go forward with a lot of lag from the controller. I tried adding a thread to it but it still blocks the code.
I couldn't format my code correctly for the site so heres a github link https://github.com/OoDone/RcCarPython/tree/master
Upvotes: 0
Views: 62
Reputation: 19395
Not knowing how many CPU cores are used on your Arduino, I could imagine that one and the same core executes both Python threads, so that the busy loops in the function pulseIn
slow the main loop. You could try inserting e. g. a sleep(0.001)
in the
while(GPIO.input(pin) != level):
and
while(GPIO.input(pin) == level):
loops.
Upvotes: 0