Hi guys,
I try to use the on-board button on the mBot to change the variable, so that the color of LED will change from “red -> blue -> green” and form a loop of “red -> blue -> green”, one step for one press.
However, it seems that the order is not the same as I programmed. Sometimes, it is red -> blue -> green -> blue. Sometimes, there is no blue color. Or, it may stuck at blue, and need to press many times before changing to red. It seems that the variable behave strangely.
May I know how to tackle this problem?
Or any other method that I can use the on-board button to control the variable.
Thank you so much for your help!