IR remote event driven button sensing


#1

Hi all,

I’m looking for a reliable framework method for sensing the buttons on the IR remote and acting accordingly. Here’s what I’ve come up with so far - the main issue I’m running into is ‘de-bouncing’ the buttons - the code senses the held button repeatedly so it is hard to have it simply toggle the buttonA on or off. I wondered if anyone had any comments/better ideas? Obviously the code that runs when buttonA = on could be anything - flashing the LEDs is just a sample block of code.

29

Thanks for any suggestions!

Edit - I know that the code won’t upload to the mBot as is due to using on and off in the variable - 1 or 0 will work for an uploaded version.