Brandon, new here and to script and relay work, I hope this is not too old to reactivate, I have a Maestro 6 channel which I want to use to control 3 micro relays that will operate model rr switches from 3 momentary push buttons, 1 push moves rr switch from start to end positions, 2 push returns rr switch to start position.
I started by using the last script in this thread and immediately ran into trouble of my own making/knowledge lack.
The relays I am using have been set with the sliders to determine a minimum start point of 1312 ms and a max of 1696 ms, this is the total relay movement needed to operate the rr switches without binding them.
Using the control panel on a PC I have set the following basic parameters:
Positions 0 to 2 are inputs 1, 2, 3,
Positions 3 to 5 are Servos 1, 2, 3, with the following parameters, Rate at 63 htz, Min at 1312, Max at 1696, Smart Error at OFF, Speed at 10, serial is UART, fixed baud rate, all other parameters are default.
I will include the script I have modified for my use (note I have disabled some lines in order to get the first servo working) before going on.
I am now at the point where servo 1 will move from start position to end position but does not return on the 2nd push. I can operate the servo properly with the slider. I assume I have a serious issue with the way I converted the ms in the setup to script which means the script never reads the changed servo position. I have tried changing the script parameters but this either did nothing or made matters worse by having the servo go into a loop from start to end and back continuously until I stop the script.
I hope I am using the proper understandable terms and you are able to provide some guidance, here is my script.
# When the script is not doing anything else,
# this loop will listen for button presses. When a button
# is pressed it runs the corresponding sequence.
button_a if sequence_a endif
#button_b if sequence_b endif
#button_c if sequence_c endif
# These subroutines each return 1 if the corresponding
# button is pressed, and return 0 otherwise.
# Currently button_a is assigned to channel 0,
# button_b is assigned to channel 2, and
# button_c is assigned to channel 3.
# These channels must be configured as Inputs in the
# Channel Settings tab.
0 get_position 500 less_than
#1 get_position 500 less_than
#2 get_position 500 less_than
#These subroutines each perform an arbitrary sequence
#of servo movements. You should change these to fit
# your application.
0 get_position 6000 less_than
8000 3 servo 500 delay
4000 3 servo 1000 delay
#1 get_position 6000 less_than
#8000 4 servo 100 delay
#4000 4 servo 1000 delay
#2 get_position 6000 less_than
#8000 5 servo 100 delay
#4000 5 servo 1000 delay
Thank you in advance for your help