2 Servos moving random, specific angle and speed

#1

Hello everyone, since a few weeks I’m trying to make a simple but maybe strange function.
I want 2 servos to move random positions within a range of maximum 40° left/right.
They have to start slowly moving after pushing a button and stop and center slowly after pushing the button again.
Simple right? But everything I tried doesn’t nearly work like this.

I want to make a simple eye animatronic without any potentiometer or remote control, just automated eyes that look anywhere anytime.

Maybe it is better to define some positions that repeat in a loop.

Does anyone of you have a good solution how to do this?

0 Likes

#2

If you are moving eyes, you want them to move together, so you can use one servo, or at least one output to control both.

If you want them to move slowly, you probably want a fade node to feed the servo position.

The target position for the fade node will normally be 0.5 (center). Pressing a button will change this to 0.5 + (or -) 0.2. Pressing button again changes it back to 0.5. This is a perfect place to use a toggle node. The toggle could feed an if-else node to select center or side. Side value could be 0.5 + (0.2 × direction) where direction is 1 or -1. Direction could be output of if-else where COND is ((system-time modulo 2) equal 0) to give a random direction. You will only want a new system-time when button is pushed.

2 Likes