Hi,
I’m wondering if there is a way for one button to make an arm go at a certain potentiometer value.
For example i press Btn5U and the arm would go at a potentiometer value of 1500. Then 5D is pressed to go all the way down. Then 5U again but to go at the potentiometer value of 1300.
Well, if you don’t need the arm height to be precise and the arm is not overly powered, you could probably do it with a simple while loop. You can also set a “flag” that keeps track of whether or not you have already gone up to a pot value of 1500 in a previous command. Then you can toggle that flag value depending on what you did in a previous command.
The concept is roughly something like this:
if Btn5U is pressed and Flag = 0
while (ArmPotValue < 1500)
arm motors raise up
so when ArmPotValue > 1500, you stop the motors and toggle the Flag =1
if Btn5U is pressed and Flag = 1
while (ArmPotValue < 1300)
arm motors raise up
so when ArmPotValue > 1300, you stop the motors and toggle the Flag =0
Note that if the arm overshoots the desired value too much, then you will need a PID control, as Dr. Gupta suggests.
true, for most autons u can get away with some slop, so some shortcuts can be used like bang/bang and other stuff. Altho im not entirely sure if ur code produces the intended behavior that the OP seeks.
lmfao. I’m a sophmore in highschool. 40% triggered- 60% amused by this.