Claw Errors!

My group robot will move up and down and also open and close but will not do both at the same time.

1 Like

You probably have them in whiles, put them in ifs instead

im new to robotics, so i dont really understand

what do you mean by ifs and whiles

1 Like

If you coded your controls so that while(buttonpressed) the loop will execute continuously without executing any other code until you let go of the button. If you code it like if(buttonpressed) it will only check once and run the rest of your code. Given that all of your control code is in an infinite while loop, it’ll check if the button is being pressed and execute all of the other code seemingly simultaneously.

1 Like

Thanks i’ll try that.

1 Like

what do you mean by that

What do I mean by what?

the entire paragraph that you sent because it confused me

While loops run until the statement is false. If statements only run once.

If you use multiple while loops then the outermost loop won’t keep running the rest of the code until the innermost while loops stop running. You guys are going to want one big while loop to continually check if your buttons are being pressed. Inside of it you’ll use if statements so that the code only goes through your if statement once for each time through your big while loop.


so what you are saying is that it could be the code

ok, our teacher thought it was the censors in the front but im not sure if thats true…

Yes it may. We might be able to give you guys a sure fire solution if we could see your robot and code if possible.

1 Like

ok i can send a photo on thursday maybe

just an fyi censors is spelled sensors but no worries. I dont think it would be your sensors case they would not usually have a direct impact to your claw unless they affect the program or they get stuck on the claw.

Oops, im terrible at spelling. But ok, im not sure if it was the sensors, but it doesn’t really seem like it

In general, it’s a good idea to post your code when asking for help with a problem you think might be programming-related, otherwise it’s much more difficult for us to debug code we can’t see and don’t know anything about. The problem and solution outlined by @224x and @Deicer is a common one, and a good guess based on the information available, but in future we’ll be able to help you much more quickly if you post your code.

When posting code on the forum, please remember to wrap it in [code]...[/code] tags or triple backtiks (```) for formatting.

Our robot claw is not moving up or down and every time we try to use it we can only use one or the other

You should not put this on the official answers.
Also, pictures would be nice

1 Like

also code