Scenario :
So, we are trying to program the potentiometer so that we can set up an angle for the the ball shooter (Arm). We searched up the internet and found out that there is a commandment called, “untilPotentiometerGreaterThan”, which pretty much helps us set up the angle for shooting. However, when we compiled the code, we were not able to do it because the commandment does not exist.
Question :
Are there any other ways to set up the angle instead of using untilPotentiometerGreaterThan? If not, how should we use the program?
untilPotentiometerGreaterThan was part of what’s called ROBOTC natural language. The commands for natural language were changed a number of years ago, that command is now obsolete (although still available if you select legacy natural language option)
The function that implemented untilPotentiometerGreaterThan is very simple, it looks like this.
void untilPotentiometerGreaterThan(int position = 2048, tSensors sensorPort = in6)
{
while(SensorValue[sensorPort] < abs(position)){wait1Msec(1);}
}
It compares the current value of the potentiometer with a target position and returns when that position is reached. you would start the arm motor before calling it and stop them when it returns. I would recommend creating your own “move arm to angle” function that combines that logic with the specific motor control for your robot.