Peter Simpson Expert Licensed User Longtime User Mar 7, 2017 #1 Trying to translate some Arduino IDE code that uses attachInterrupt can be awkward, especially when needing to use the mode Parameters like 'Mode' which defines when interrupt should fire, RISING, FALLING, LOW, HIGH etc. I have some code but I have absolutely no idea on how to translate it without attachInterrupt. I have though about sing StateChanged and then trying mimick RISING, FALLING, LOW, HIGH etc by pre-storing pin states, but attachInterrupt would just cure everything. Admittedly I feel pretty cheeky asking for a wish for a great package like B4R, especially when it's already free. To tell you the truth it's taken me a few day to decide to create this post. Actually I wish there was a paid version, then I could request wishes at will Thank you...
Trying to translate some Arduino IDE code that uses attachInterrupt can be awkward, especially when needing to use the mode Parameters like 'Mode' which defines when interrupt should fire, RISING, FALLING, LOW, HIGH etc. I have some code but I have absolutely no idea on how to translate it without attachInterrupt. I have though about sing StateChanged and then trying mimick RISING, FALLING, LOW, HIGH etc by pre-storing pin states, but attachInterrupt would just cure everything. Admittedly I feel pretty cheeky asking for a wish for a great package like B4R, especially when it's already free. To tell you the truth it's taken me a few day to decide to create this post. Actually I wish there was a paid version, then I could request wishes at will Thank you...
Erel B4X founder Staff member Licensed User Longtime User Mar 8, 2017 #2 You are more than welcome to make suggestions. It is important that B4R will be useful. Interrupts are problematic. B4R code can never run from an interrupt as it will very quickly result in corruption of the memory structures. Note that it is also problematic if you are writing C code and can easily cause all kinds of "strange" issues. The internal B4R framework does support interrupts. You can see an example in rWire library.
You are more than welcome to make suggestions. It is important that B4R will be useful. Interrupts are problematic. B4R code can never run from an interrupt as it will very quickly result in corruption of the memory structures. Note that it is also problematic if you are writing C code and can easily cause all kinds of "strange" issues. The internal B4R framework does support interrupts. You can see an example in rWire library.