|
Re: EasyC Vex Programming help in RC Mode
If your mechanism does not need a lot of power (see Mike's post), then you can limit the speed in software. First you would map the Rx Input to a variable. Since the values coming back from the transmitter range from 0 to 255, with 127 neutral, we subtract 127 so our values are now centered around 0. (Don't declare your variable as an unsigned char, use int here!)
The next step is to multiply our new value times a coefficient between 0 and 1. But since the controller only likes to play well with integers, if we want the motor to only go 60% of max speed, we can multiply ourVariable = ourVariable * 6 / 10; with replacing ourVariable with whatever you declared your variable as.
Then we add 127 back into this, and set this value to the motors. By adjusting the coefficient, you can narrow down or widen how much available speed you want to send to a motor.
|