Quantcast
Viewing all articles
Browse latest Browse all 5229

MicroPython • Re: Help with interrupts

Ok thanks.
I WAS getting caught in infinite loops in my functions and assumed an interrupt or poll could be used to listen out' and break out of the loop.

To avoid infinite loops in the function I guess I could write a for loop or sequence and get it to check the current value of e.g. 'buttonClick' at the end. It it will rerun the current function if the button global value has not been incremented.

I think some examples I have seen are passing a parameter as the current value of buttonClick but I have found this confusing, so the above model is simpler.

IRQ was mentioned and have seen this in examples.
Does the pixelzero library do the same thing?
e.g. button1.when_pressed = function1

Statistics: Posted by Stu9000 — Sat Dec 23, 2023 10:10 pm



Viewing all articles
Browse latest Browse all 5229

Trending Articles