Maestro Polulu 24 + Arduino

Hello

I have a little problem with commands to move my servos using Arduino Nano v3 with cooperation
Maestro Polulu 24. I Tried to use basic script from other Topics just to make it move but its still not working. Can you please help me? I send my scripts below from arduino and maestro. Code is compiled by arduino and i get score like in the screen below, nothing happens :frowning:

# Sequence 0
begin
  500 6316 5709 0 0 0 0 
  0 0 0 0 0 0 
  0 0 0 0 0 0 
  0 0 0 0 0 0 frame_0..23 # Frame 0
  500 5827 6121 frame_0_1 # Frame 1
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_0_1
  1 servo
  0 servo
  delay
  return

=================

#include <PololuMaestro.h>

#ifdef SERIAL_PORT_HARDWARE_OPEN
  #define maestroSerial SERIAL_PORT_HARDWARE_OPEN
#else
  #include <SoftwareSerial.h>
  SoftwareSerial maestroSerial(1, 2);//TX, RX, 
#endif

MicroMaestro maestro(maestroSerial);
//MiniMaestro maestro(maestroSerial);

void setup(){
  maestroSerial.begin(9600);
  Serial.begin(9600);
}

void loop(){

  maestro.restartScript(0);
  Serial.print("1. \n");
  delay(4000);

  maestro.restartScript(1);
  Serial.print("2. \n");
  delay(4000);
}

obraz

Hello.

The restartScript() function restarts a Maestro script at a specific subroutine. Since you are passing it an argument of 0, it should be trying to start at the first subroutine declared in your Maestro script, which would be sub frame_0..23. To start at the top of your script from the BEGIN command, you need to define a subroutine for the BEGIN/REPEAT block. For example, you can add sub main before your BEGIN statement and quit after your REPEAT command, which would look like this:

sub main
  begin
    500 6316 5709 0 0 0 0 
    0 0 0 0 0 0 
    0 0 0 0 0 0 
    0 0 0 0 0 0 frame_0..23 # Frame 0
    500 5827 6121 frame_0_1 # Frame 1
  repeat
quit

Additionally, to make your script run though only once each time you call maestro.restartScript(0), you can remove the BEGIN and REPEAT commands entirely.

If you try modifying your script like this and run into any problems, you can post your updated script and I would be happy to look it over.

Brandon