I was wondering if anybody knew how to make a macro that will make a rd4b go to a certain height from any point.
you would have to find a way to calculate the height of the lift. then simply compare where you are from where you want to be, and simply move.
I’m not sure how you would calculate the height of the lift though. If you don’t want to calculate it, you could make 5-6 control points and pick between them
I haven’t used robotc in a while and i don’t have any code for it, but i am pretty sure all you have to do is make an “if” command for the button that activates the macro, them code the motor to run for however many rotations or how long to get the right height and put that in the “then” command. Then make and “ifelse” command that doesn’t run anything. And make sure everything is semi-coloned and in the correct braces.
Use encoders and the function setMotorTarget.
task main()
{
while(true)
{
if (getJoystickValue(BtnRDown) == 1 )
{
setMotorTarget(someMotor, somePostion, motorSpeed);
......
}
}
}
can you do this for multiple turns
I’m having a problem with the motors to where they won’t move more than an eighth of a rotation I’m in iq. It only works with timing
The code posted is for teleop. You can do this repeatedly every time you press button R down (but you can change that to any button you want). For the motor only moving an eighth of an inch, Instead of timing, you can use wait commands like waituntilmotormovecomplete. However, you shouldn’t have to use that unless you have some other code that is also issuing a command to the same motor.
Please post your code if you need more help.