Quote:
|
Originally Posted by Joe Ross
If you want to skip the if statement, you can use the following code
pwm03 = 127 + 63 * p1_sw_trig;
If you want your motor to be able to go backwards also, you can use 2 switches with the following code.
pwm03 = 127 + (63 * p1_sw_trig) - (63 * p1_sw_top);
|
just a cautionary real-world note, although this may work for the FRC, in actual C, the value of "true" for booleans is not always 1 - in fact, it's often -1.
but yes, for the FRC, one could use Joe's code.