Multiple servos with different scripts

Hi all,

Hope this hasn’t been talked about, but is probably a simple question for most. I have a Mini M 12 and will be using switches on some channels and servos on others. Each servo will be doing a different task so each one needs a script of it’s own. Hypothetically, this could mean 6 or more scripts. So, saying I am using 6 different servo channels and I need a different script for each servo on each of those 6 channels, what is the procedure for entering and saving the scripts for all 6 channels? I already have one script written, but I need to know how to add the others.


You need to write one script that does six different things.
If you have a function/loop that gets called to update the state of the world, over and over again, you can just write out each of the things.
The main problem comes with “delay” type functions; you need to re-write your code to set timestamps into the future, and check whether time has gotten to that point, and if so, do the right thing and calculate a new timestamp.

Thanks jwatte for your reply.

Ok, one script that does 6 different things. That answers my question.

At the moment I only have one script that listens for either of two switches to be moved, delays for 25 seconds and then returns the switch to it’s original position. I have another servo that receives instructions from PC based software , so no script for that one. They should both work fine together.

My question was based on adding more servos with different instructional scripts in the future and that is clear now. I need to study more on the time stamp thingy though. Thanks again for your reply.