Hi,
I have a question about programming more than 1 limit switch. I have programmed one switch using Easy C and the switch works perfectly. I programmed this one switch to turn right if it gets hit on the left side. When I tried programming two limit switches (one on the right and left side) they didn’t work correctly. When I placed the robot on the ground, it didn’t turn smoothly when the left or right limit switch was hit. Instead of turning smoothly, the robot twitched as it turned. The motors turned in the right direction but turned on and off repeatedly.
When I programmed it I put both limit switches and "if else" statements into one while loop block (which was 1 == 1.) One limit switch was in digital port 6 and the other in digital port 7. The "If" statements had a Tank 4 motor block in it and the "else" statment had the robot turn left or right. I don't know if this a programming error or if something else is wrong.
Can you please help me. It would help if you could send me a link or picture of the correct programming code for a 4 wheel robot (controlled by a controller) that has 2 limit switches on the front of the robot. If the left switch gets hit then it turns right, if the right switch gets hit it turns left.
Thank you in advance, I really appreciate your help!!!!!!!!!!!!!!!!!!!!!