Hello Nick R1216,
You can determine the direction of a motor based on the value that you send to the PWM. For example, a +1 will make the motor rotate forward, and a -1 will make it rotate backward. However, you mentioned controlling the same PWM with two different triggers, and that may cause problems. Think about cases where both triggers are pressed, or non are pressed, or when you only press one trigger and not the other. Each trigger is always going to send a value to the PWM and the values will overwrite and you will be getting an indeterminate behavior. To avoid this, you have to create an action for every combination of trigger presses. A truth table can help you make sure that you have considered every case of trigger values. This requires checking multiple logic levels. For example, you may want to check if a trigger is pressed, and if not ignore that value, and check the other trigger.
The following snippet might give you an idea of how the checking might start. The code is incomplete, but you should be able to finish or alter it to you meet your needs.
I hope that this helps,
Regards.
Sal H.
Applications Engineering
National Instruments
Sal H.
Applications Engineer
National Instruments