I know very little about programming and am just getting started with script writing for a Maestro Micro. Can anyone provide script for a two joystick input? If possible, I want to use only the Maestro Control Center. I have a crude 12 line script currently controlling the motors.
Here are my requirements:
- Three 5K thumbsticks will control three PWM motor speed controllers.
- 5K ohms will be 100% reverse, 2.5K ohms will be Off, zero ohms will be 100% forward.
- Motors must be OFF at program startup.
- Motors must return to OFF if a thumbstick becomes unplugged.
- Need to match (calibrate) script midpoint value to thumbstick centerpoint.
You might consider starting out with only one axis from a single joystick and expanding your code once you get it working. The “Using an analog input to control servos” example script is probably a good place to start. You can find this example in the “Example Scripts” section of the Maestro user’s guide. If you have any specific questions about the script language, I would be happy to help. Also, if you run into problems while writing a script, you could try posting what you have so far and seeing if someone can offer a solution.
The control box is built. Now, I’m trying to build the control script. Starting with a simple 12 line script for three potentiometers controlling three Cytron MD10C motor controllers. The script sees the inputs and controls the correct outputs. The PWM signal will operate Talon and VEX motor controllers, both forward and reverse.
The PWM signal will NOT control the MD10C. The problem is the parameters of the PWM signal; 1-2ms at 60 Hz.
Cytron: LOCKED-ANTIPHASE PWM
For Locked-Antiphase PWM operation, only 1 control signal is needed to control the speed and direction of the motor. PWM pin is connected to logic high while the DIR pin is being feed with the PWM signal. When the PWM signal has 50% duty cycle, the motor stops running. If the PWM has less than 50% duty cycle, the motor will turn CW (or CCW depending on the connection). If the PWM signal has more than 50% duty cycle, motor will turn CCW (or CW depending on the connection).
What is the script for this type of signal?
The Micro Maestro outputs standard RC hobby pulses and cannot be used to generate PWM signals. As noted in the “Status and Real-time Control” section of the Maestro user’s guide, the 12-, 18- and 24-channel Maestros each have a single PWM output channel. I am not familiar with the Cytron MD10C, but it sounds like it needs PWM signals. You might look into using an electronic speed control (ESC) between the Maestro and your motor instead. Alternatively, you could also use a microcontroller (such as an Arduino or A-Star programmable controller) to generate PWM signals in place of the Maestro.
Thanks Brandon. With the research on this project, I now understand the difference between “servo PWM” signals and “true PWM” signals. I am looking for an inexpensive solution to the problem. Replacing the Cytrons with multi-input controllers is about $120. Using the Cytron motor contrtollers at $50 (17 each), in conjunction with a true PWM board at $25, will keep the costs low.