I want to run a servo and check for a button press simultaneously on a Micro Maestro 6 - channel. Given the limitations (no multi-tasking), I will use the following pseudocode:
Keep in mind, I have to keep the servo running all the time.
- Pass next position to servo.
- Check for button press for 50ms.
- if pressed, turn led on channel 3 on for 2 minutes.
- if not, keep on passing next position to servo.
I am new to this scripting language. Can someone please help me out?
I know it will be a small variation in the button press example. But I can’t seem to understand the language.
You might be able to do something like that with a Maestro script depending on how you want the nuances of your pseudocode to work. For example, if you want the two minute timer for the LED to be non-blocking, you can see an example of using the
GET_MS command to implement a timer with non-blocking code in this forum post. However, since you are new to the scripting language, I suggest starting with smaller examples like the ones found in the Example Scripts section of the Maestro User’s Guide. Also, you might find the “Step script” button in the “Script” tab of the Maestro Control Center helpful for understanding the scripting language. You can use this button to step the script through one line of code at a time, so you can see the impact of each line before moving on to the next.
If you try writing your own script, and run into problems, you can post what you have here, along with a description of what it does and what you want it to do, and I would be glad to take a look.