Servo move to a location, then stop

Hi @alto777

This phrase doesn't make much sense in my language and culture.
You can make it your meaning.

Thank you very much.

RV mineirin

You are right. The sketch is busy with do the turning of the servo.

Okay, so I had a play around with the various examples offered and they seemed largely successful. So the bit I'm a bit confused at here, is which to go with. I'm not sure I understand what the distinguishing factors are here.

The action based on what happens when you continuously hold the button down probably isn't too important. I guess if it's held down, I'd like it to perform a single sweep and wait until the next press? The ultimate plan would be to replace the button with something essentially controlled by LabView, which itself has it's own delays and... idiosyncracies.

What is an edge detector?

An interesting thing to note, is it seems to sweep out slightly more than 180 degrees now, which is unexpected. It's not really a huge problem, since this project aims to put an object blocking a path, or anywhere else (i.e. not blocking the path). Just thought it was worth mentioning

Your original code does things based on whether a button is pressed or not. Edge detection is just fancy talk for reacting to changes in the button pressed-not pressed condition. Edges are when the switch goes from pressed to not pressed and vice versa.

In addition to looking for when a button becomes pressed, rather than when it is (still being) pressed, edge detection must usually include provision for contact bounce, the fact that buttons do not make closed circuits once and definitely when pressed, but rather exhibit a period (milliseconds time scale) during which successive reads of the digital input would yield a rapid and random series of HIGH and LOW values as the contacts eventually settle down and make good. Contact. That all under the general concept of debouncing, a subset of the larger problem which is deglitching any digital signal to ferret out meaningful states.

Well servos be servos, so one might find travel to be different. If however you are saying the some new code makes the servo go further when asked for 180 than some older code, that does sound impossible unexpected.

If the servo gets told to sweep open over to 180, and then you tell it nothing more, how you got there shouldn't matter.

If you have your hands on code that can demonstrate before and after, or two sketches that show this difference, post them here so we can have a peek and either explain what you are observing or we all learn something.

Have you told us the make and model of the servo?

a7

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.