Switch case, button pushing problem


#1

Hi, I am programming a lego ev3 robot in doing different commands when I push the same button several times. For an exampel one push is equivalent to the robot going forward. 2 push makes the robot go backwards and so on. The problem I have is that it is suppose to move forward when I push the button one in a short time period, and if I push the button 2 times in a time period it will go backwards. The code I have now makes the robot go forward in one push, but if I press the button one more time it will go backwards.

mvh a struggling student


#2

Please tell us what language this is written in.

Why does case 4 not have a return statement?