I need to trigger a script with a button Ive already got it soldered on with the resistor etc. It works and i tested it on the example button script. I cannot figure out how to get this to active a sequence script. Can someone please post an example script for this that i can (hopefully) just paste in my example script. I tried pasting my sequence into the bottom of the button example script in place of the frames it has default however it would not return to start position. What i need is for it to activate the first step of the script when i push a button. Then the next step when it is pushed again. Then the final step in which it returns to original position. Basically each time i push the button it does a step. Sequence script is pasted bellow. This is my first post so i hope it formats correctly. (EDIT) The button is on channel 0
Probably the simplest way to start your script with a button press is to add a WHILE loop to the beginning that exits when the button is pressed. You can find some code for doing this in my post here. Please note that the code there is for a button on channel 5; you can change the 5 to a 0 to make it work for your button on channel 0.
If you put the WHILE loop before your BEGIN/REPEAT loop, the sequence will repeat forever once the button is pressed. If you want the sequence to wait for the button every cycle, you can put the WHILE loop inside of your current BEGIN/REPEAT loop.
Err… this is embarrassing. I think im missing something but… when connected to usb it works perfectly, however when i unplug it it lights up the error light and doesn’t work (also the servo vibrates a bit). The script is set to run on startup and have tried both 4 AA batteries and 6v from a lab power supply. I read through the manual and was unable to find the issue. I also tested it with just a sequence back-and-forth script and that didn’t work either. I do have the blue jumper connected.
EDIT: Apparently i wasn’t providing sufficient amperage i dialed it up to 2 amps and it works fine.
Can I ask what you mean when you say “inside” of the BEGIN/REPEAT loop?
I’m still having no luck getting the script to start when I toggle the switch on (pulling input pin 8 low), play one sequence, then wait until the switch is toggled off (pin 8 high), then on again before it plays the sequence once more. this is my current script
begin 8 get_position 200 less_than while #switch low to start sequence
3000 3986 3986 3986 3986 0 0
0 0 0 0 0 frame_0…7_9…11 # Frame 0
3000 8000 frame_0 # Frame 1
3000 3986 frame_0 # Frame 2
begin 8 get_position 200 greater_than while #switch high before restart switch low possible
I know something is wrong but I can’t figure it out