EZBlock threading?

I’m playing with EZBlock and our Picar-X, very cool!

However, my main loop is getting a bit slow, and I’d like to offload some operations to a separate thread. I see blocks for threading in EZBlock Studio, but no documentation on how to use them. Could you provide an example?

(I am an experienced programmer and understand multi-threading. I just don’t understand the syntax in EZBlock)

Ezblock’s Block is directly escaped into Python and then run. thread is python threading. this is a simple example:

Note that Threading Method is a function name that is filled in directly as a string. It should correspond to the function name below. Also note that the function name should conform to the python function naming convention.

Thanks! However, I think I’m still doing something wrong. I replicated your example:

But when I run it I get:

I’m running EZBlock Studio 1.2.4 on Android.

I’m very sorry for the incorrect positional organization, please follow as shown.

Got it, thanks!

(I put the ultrasound sensor in its own thread. It was taking quite some time per cycle, probably just waiting for some interrupt of the return signall

I don’t quite understand your question, what kind of problem are you encountering?
Please provide us with a picture of the problem, or send us the code block you need to execute, so that we can analyze and solve the problem.

Sorry for the confusion. Putting the function at the top solved the problem, and all is working as intended.

1 Like