Hey microguy,
Let me see if I get this right.
You want a way to customize the actions performed by the Arduino when you press a button.
And, at the moment, what you have is a set of buttons that are connected to actions and all is hard coded in the app.
The way you solve this is not easy. Not easy to explain AND not easy to implement.
But here it goes...
First of all you need to create the complete set of procedures with all the SINGLE actions that you want to
script.
So something like:
procedure LED(const Number; const On: Boolean = True);
procedure Servo(const Number; const Position: Integer);
And after that you need to create your OWN interpreter of a simple scripting language.
On some kind of UI you setup a script editor for each button.
For each button, you store a script and when the button is pressed you
run that script.
A script would be something like this:
LED0 ON
WAIT 3
LED1 OFF
SERVO1 1000
SERVO0 250
Now when you're parsing your script and encounter
LED0 ON you call
LED(0, True)When you encounter
SERVO0 1000 you call
SERVO(0, 1000)When you encounter
WAIT 3 you call
Sleep(3000)When you get all this implemented and you feel it's solid you can then try to implement cycles.
After a while you'll miss them

Am I making any sense?
Cheers,
Gus