Stack Over/Under flow problem

Im trying to controll a hexapod robot with a mini maestro 24 via serial commands from an arduino

I compile a script with a simple routine to walk forwards and try to call the sub routines from the arduino via the commands:

    MaestroSerial.print(0xA7, BYTE); // command to call up subroutine
    MaestroSerial.print(0x00, BYTE);    // subroutine number

and i keep getting an error code of 0x0040 wich is stack over/under flow

here is my script:

[code] # WalkForwards
begin
200 6112 5840 5840 8112 7840 5840
6112 5840 5840 4112 3840 5840
6112 5840 5840 6112 3840 0
7840 0 0 0 0 0 frame_0…23 # First Step
200 5840 5840 5840 frame_4_10_16 # transitionFromFirst
200 7840 3840 6112 8112 7840 6112
4110 3840 5840 frame_1…3_6_7_9_12_13_18 # Second Step
200 5840 5840 5840 frame_1_7_13 # TransitionFromSecond
repeat

sub frame_0..23
  23 servo
  22 servo
  21 servo
  20 servo
  19 servo
  18 servo
  17 servo
  16 servo
  15 servo
  14 servo
  13 servo
  12 servo
  11 servo
  10 servo
  9 servo
  8 servo
  7 servo
  6 servo
  5 servo
  4 servo
  3 servo
  2 servo
  1 servo
  0 servo
  delay
  return

sub frame_4_10_16
  16 servo
  10 servo
  4 servo
  delay
  return[/code]

now i know i have to replace the returns with a quit command but when i attempt this i get the same error code
Im confused on how to properly do this

–Richard

You are sending the serial command to start subroutine 0, but in your script subroutine 0 is just “frame_0…23”, which won’t do anything useful and will immediately result in a stack underflow error because there is nothing on the stack when “23 servo” is executed.

Try using the “Copy all Sequences to Script” button instead. That should create a subroutine for your sequence.

–David