Simple servo sweep without a pot?

I’m struggling to figure out how to move a servo to a value like .5 then .9 and then .1. Any online tutorials only use a pot instead of variables. I am not proficient with c++ but even that is easy for me to program. I’ve tried to do it in the main patch like servo with .5 linked to another with a .9 value, etc., to boot->defer->servos and using new patches with set->(also tried delay here before servo)servo->(also tried defer before Done)Done and in the main BOOT->defer->(servo with .5 val), etc.

Is there a simple way of doing this?

There are a couple options. The one that might be most obvious is to use delay timers to step through several servo nodes, all with the same port #, but different position values (which sounds like what you did), but this doesn’t work unless you use a servo node that can be disabled (gweimer/servo/servo-enable is an example) because multiple built-in servo nodes will compete to control the servo instead of releasing control when you think it should be “done”.

The other option is to change the position value fed into a single servo node. You might be able to use a count or fade node to get the values you want if they are evenly spaced, or simple arithmetic can provide the values you want. An alternative is to use a select node to feed the servo position pin. Delay nodes can be used to pulse the different pins on the select node to cycle through the values.

1 Like

I actually already have your library and was checking out the servo-enable. Thanks for the info. I’ll try both options out tonight.

Can someone please make a screenshot? I have been trying to build this “simple” setup for two days now. I know i am not the brightest but this is just ridiculous!

I need to keep the servos true while the delay is active that drives them yet start he next ones while… and no i cant use a single tutorial because for some reason you need the minimal pulse width that you have to look up and is of course available for ALL servos.

PLEASE!
I am going insane here. I though XOD should be easier?

In general, it is best to control a single servo with a single node. Rather than have multiple servo nodes with different values, change the value for a single node. A big problem with multiple nodes that you enable/disable is that servo will “float” when they are all disabled rather than hold it’s last position (besides the risk of having 2 servo nodes active at the same time, as you are doing here since your delays add up to more than 6 seconds, so you are starting next pulse before previous one finishes).

One possibility for changing input values is to use a select node:
image
You can expand the select node and add more delays to trigger additional positions settings. In this case, if your delay nodes add up to more time than your clock pulses, you will jump between settings rather than try to position the servo in two locations at the same time.

If you really want the servo to float for some amount of time, you can link delay-ACT to ‘not’, then to servo-ACT so that servo will be disabled while that delay is active, while still only using a single servo node with changing input values.

thank you!
thank you!
thank you!

I greatly appreciate your input here, somehow i feel it weren’t for you there would be no XOD
May you live long and prosper :slight_smile:

While I appreciate the compliment, I am only helping people with general programming issues. Others have created XOD and continue to improve it while still others are creating XOD wrappers to make it work with additional hardware. While I may be making more posts and helping ease the frustrations of many, they are doing the hard work of making XOD successful.

yes of course a big thank you to the entire team

i figured it out, it wasn’t the code, it was the servo somehow making the arduino bug out and stop even if i gave the delay lots of time, noticed by accident that the board lights up even if not connected if i turn the servo by hand
i know it is mentioned at the end of the first servo tutorial… but still, this is just so incredibly infuriating, now i have to figure out how to connect it differently and or play with the fade node, though i kinda need the fast torque.

anyways thanks, i just dont understand why all the diagrams connect the servo directly at all if it is likely to bug out, VERY confusing for illiterate people like me