Hi,
I’ve managed to connect my micro maestro to my Arduino and run all the example codes.
But the one simple thing I want to do does not seem to work and it might be because I am still very new to the scripting for Maestro.
I want to press a button attached to my Arduino that will start a simple Sequence that I have saved and copied to the script of the Meastro Control Center. I can’t figure out why it is not working though. When I press the button I can see that it has started the script in control panel and that it is running through thte stack values that are shown on the left. However, the motors only move to one position and then stop… Please help! I am sure it is a simple issue…but I can’t spot it. I assume that there is something that I might need to add to the maestro script (which I have simply created through the sequencer and copied to the script), but again, I am not finding any info that I really understand to be honest.
Here is the Arduino code:
[code]#include <PololuMaestro.h>
#ifdef SERIAL_PORT_HARDWARE_OPEN
#define maestroSerial SERIAL_PORT_HARDWARE_OPEN
#else
#include <SoftwareSerial.h>
SoftwareSerial maestroSerial(10, 11);
#endif
MicroMaestro maestro(maestroSerial);
const int buttonPin1 = A0;
int buttonState1 = 0;
void setup()
{
maestroSerial.begin(9600);
Serial.begin(9600);
pinMode(buttonPin1, INPUT);
}
void loop()
{
buttonState1 = digitalRead(buttonPin1);
if (buttonState1 == HIGH) {
maestro.restartScript(0);
delay(4000);
}
else {
maestro.stopScript();
}
}
[/code]
And the Script:
[code]# Sequence 3
begin
500 5888 8000 0 0 0 0 frame_0…5 # Frame 0
500 6139 4222 frame_0_2 # Frame 1
500 6238 frame_1 # Frame 2
500 8000 frame_2 # Frame 3
repeat
sub frame_0…5
5 servo
4 servo
3 servo
2 servo
1 servo
0 servo
delay
return
sub frame_0_2
2 servo
0 servo
delay
return
sub frame_1
1 servo
delay
return
sub frame_2
2 servo
delay
return
[/code]
Best
Nelmarie