I am programming a new system for our robot, but I have run into a programming problem. Whenever the arm goes up, it lowers by itself. I have already tried adding more rubber bands for support, but they cause other problems. I would like to solve this through programming. Can anyone show me how to get the motors on the arm to keep going at little power so the arm doesn’t go down by itself? Help would be appreciated.
Okay so you need to set up an if command block. The code should look like
If(both buttons are not pressed)
then motors run at 15 power up.
your normal lift code.
Or you can set up
then motors run up
else if(down button)
then motors run down
motors run up with 15 power
I don’t have a copy of EasyC or I would show you the block combination.
I still haven’t learned easyC, but the usual thing to do (after applying elastics), is to set the motors at a value of 10 to 15 (which the motors can usually sustain without overheating) after you have ordered the arm to go up. Ordering the arm down, of course, would reset the motors.
If you have a sensor on the arm, such as a pot or encoder, then you have other options. Do you have any such sensors?
the best option is to solve it is using proper rubber band placement and amount. the lift should stay at any position you put it without weight in it. you can then use tabor473’s code to keep it up when weight is in it. this will get you the most speed, power, and efficiency out of your lift. what type of lift do you have?
An “almost EasyC” pseudocode version of what others have described is in this post. Sadly, I’ve given up my copy of EasyC, so I don’t have direct access to the code.
As others have recommended, a “boost” (the variable in the post) of 10 or 15 can do the trick, depending on the weight of the arm.
There is a sample in the “Samples Directory” (File->Open-> Samples) that is called “PID Interrupt Service Routine”. It uses a potentiometer to and proportional control the position of an arm.
Make sure to read the readme.txt and it will walk you through the process.
If you need multiple motors just add them to the end of the function ControlLoop.
Once it works with the button, replace “nextTarget = GetDigitalInput ( 5 ) ;” to “nextTarget = GetJoystickDigital ( 1 , 5 , 1 ) ;”
Also, adding a counter balance (rubber bands/weight) will reduce the strain on the motors and prevent them from heating up and shutting down.