Author Topic: How do you loop timed movement? (or how to get an arm to move up and down)  (Read 42 times)

LadylexUK

  • Administrator
  • Newbie
  • *****
  • Posts: 19
 I have an arm socket on a robot with this code

WHEN [duration timer][2] DO [pitch][slowly]
WHEN [countdown timer][2] DO [pitch][slowly][invert]

This moves the arm up and down.

But this will only do the movement once. How do I get the arm to swing up and down continuously? I am so rusty with koding I have forgotten how to do things I knew how to do before.

Share on Facebook Share on Twitter


residentgrasso

  • Newbie
  • *
  • Posts: 8
This may not be of help, as it's been a long time for me too, but I always just used variables to count up and down.  Variable1 to contain the count value and Variable2 to contain the increment amount. I simple if statment can toggle the increment amount (Variable2) from 1 to -1 once Variable1 reaches a high or low value.

Use the Count (Variable1) to move your arm.

The only drawback is not using actual seconds for timing.  Maybe you can use a timer that calls another code tab (forgot what their called) that executes the code.

Wish I could be more specific but I'm not where I can write and test it.

Godklaw

  • Newbie
  • *
  • Posts: 1
Use the Loop tile.

WHEN [duration timer][4][LOOP] DO
    WHEN [duration timer][2]  DO [pitch][slowly]
    WHEN [countdown timer][2] DO [pitch][slowly][invert]