Micro Switch problems with Orion board and mBlock


Anyone have an idea about this issue? I’m having a problem with the Orion board recognizing the micro switch. I have 2 plugged into an RJ25 adapter which is plugged into port 6. Using the code here, I upload it to the Orion board. Then, with the USB cable still plugged in, I hit the reset button. When the code is running, it seems to work ok although at times it does not recognize when one of the switches are pressed.

When I unplug the USB cable and plug in the batteries and hit reset, it never recognizes that the switches are pressed.

Do you think it may be the way I have it coded or the way the switches are plugged in? I’ve tried reversing the cables at the bottom of the switch and it doesn’t matter.

The code can be downloaded here: https://db.tt/N1OePNCd
Image of code:

Image of the robot:

Video showing the problem:

Thank you!!


Update. I loaded the TestMicroSwitch.ino Sketch into the Orion. I wired the switches a bit differently as you can see in this picture and it worked! However, the mBlock program still doesn’t work. Is this a mBlock problem or is my code above wrong?



I guess that the limit switch is a boolean value; so your code has to be : limit switch ( port 6 etc…) = 1 ( true)

or limit switch = 0 ( false)

for touched or not touched


Hi there I think I know what the problem is that you are having… I came accross this just today…

I recommend after your increase ---- by 1 add a wait until the limit is released and it should allow you to count the presses correctly