What is 'Mini Maestro'? How is your system working currently? It's not clear what functions the Arduino performs. It can certainly do the sort of thing you're describing if the control logic runs on the Arduino, but I have no idea whether it currently does.
Mini-maestro is a servo controller made by Pololu:
http://www.pololu.com/catalog/category/12I would imagine if the OP is using the scriptting language interface, that in that script, you would have to have the ability of a signal to kill the current program.
If the OP is controlling the mini maestro from the Arduino, it likely has hard coded delays in the code. The OP will then need to recode his/her program so that it doesn't have delays, but instead maintains a work queue of when to turn things on or off using a state machine. The blink without delay example shows how to do this, but I tend to think that blink without delay probably doesn't help people getting to the next step of using a time based state machine.
Yes, I am sending serial commands to the Maestro from the Arduino. Here is a simplified example of what I am doing:
int button1 = 22; //the pin where the first switch is connected
int button2 = 23;
int button3 = 24;
int button4 = 25;
int button5 = 26;
void setup() {
//initialize the button pin as an input
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(button3, INPUT);
pinMode(button4, INPUT);
pinMode(button5, INPUT);
// initialize serial communication:
Serial1.begin(9600);
}
void loop() {
//read the pushbotton input pin
digitalRead(button1);
digitalRead(button2);
digitalRead(button3);
digitalRead(button4);
digitalRead(button5);
if (button1 == HIGH) {
//if the current state is HIGH then the button went from off to on
Serial1.println("on");
acceleration_headlift();
headlift_minimum();
delay(1000);
headlift_maximum();
delay(5000);
headlift_minimum();
delay(1000);
}
else {
}
}
The headlift and acceleration commands are just a set of numbers sent to the Meastro using Serial.write using voids... I looked at the blink without delay led example and I see how it can take the place of delays. Will this method allow for me to change the time between the functions that different buttons command? Is a time based state machine the same as a finite state machine? I will have to read more on the state machines over the weekend but they sound interesting.
Basically what is happening is I have a creature that looks around until he is "poked" (button is pressed) on the left or right side and he looks that direction. So the looking around needs to be interrupted when poked and the poked needs to be interrupted if poked in another location.