Australia
Asked

Random Servo Movement Wanted As A Demo

Hi all.

Is there anyway of having a servo randomly do stuff? Almost like a demo situation? So the robot just sits there and moves his head, or says something random.

Thanks all.

Jonno


ARC Pro

Upgrade to ARC Pro

Synthiam ARC Pro is a new tool that will help unleash your creativity with programming robots in just seconds!

#1   — Edited

There is a skill in ARC called "Personality Generator" It does just what you are asking for. I use it for my robot and it works great.

You can find all about it and how to install and use it here: ARC Personality Generator Skill

Have fun!

PRO
Belgium
#2   — Edited

hi dave &djjion

if you are using the jd robot.here is an excample for starting . make sure you dont past the limit of the d1 servo cause of the neck braket hits the body. you can play with the sleep to get better results. servospeed ,the higher the number the slower , the movement .

servospeed(d0,2) servospeed(d1,2) :loop sleep(300) servoRandom(d0,70.120) sleep(400) sayezb("make the world great again") sleep(300) servoRandom(d1,70,90) sleep(300) goto(loop)

Australia
#3  

Cheers all!

Will have a play tonight.

PRO
Synthiam
#4   — Edited

This would work as well - it's for javascript so it's faster


while (true) {


  // Move the D0 servo to a random position between 1 and 180
  Servo.setPositionRandom(d0, 1, 180);
  
  // Pause for a random amount of milliseconds between 100 and 2000
  sleep(Utility.getRandom(100, 2000));  
}

*Edited for lowercase sleep() as per javascript manual (https://synthiam.com/Support/javascript-api/javascript-overview)

Australia
#5  

Cheers DJ.

However, when i use the code i get a "sleep not is defined" error in the script runner.

Any ideas?

Jonno.

PRO
Belgium
#6  

djjon1976

you can copie the code straight from this topic .from dj .

#7  

Have you changed you script editor from EZ Script to Javascript? You can do that at the top of the editor when you go into the control to write your script.

Australia
#8  

Hi all.

Yeah copied the text directly and switched to Javascript. It does actually run the code, but i still get the error.

PRO
Canada
#9  

Hello @djjon1976

It's likely because Sleep has a capital S, make it lower case