We’re trying to add a potentiometer stopper to our chainbar, but it just flies right past the stopper. Does anybody have any suggestions for how to stop this?
Do you mean you put a bit in the code to make sure it won’t go past a certain point based on the potentiometer’s reading? Or do you mean you built a physical impediment to make sure the chain bar cannot swing too far for the potentiometer? I would guess the first. If I’m right, have you tried reading the potentiometer values? Here are a few ways that can happen, and there are probably more:
- You’re checking the wrong direction. For example, you’re saying while(pot<x) and the pot’s numbers are going down so you are always less than x.
- The pot is broken.
- The pot is disconnected at some point, so you’re not reading any changes in the value.
One of the best ways to check much of this is to get a readout of the potentiometer’s value and just move the chain bar by hand to see what readings you get.
A bit in the code.The problem is that the chainbar starts to dip down a bit just before where we need it to stop, and so it’s momentum flies right past it. We made some mods to the code and it’s working much better.
I forgot to mention a 4th point, which may have applied: continuing until the pot value equals something, because you’ll usually miss.
If it’s working better, I’m guessing you’re slowing it down over more angle as you get there, using at least a simple slew rate control.
Did you know if you overturn the potentiometer, you get extra functionality?
I would not recommend overturning a potentiometer.