The problem is that the buttons go from approximately 0 to ~255 and it's the approximate part that is the issue.
Try:
Code:
if (signal < 20){
pwm02=127;
pwm03=127;
}
The other button would be
Code:
if (signal > 235){
pwm02=127;
pwm03=127;
}
While it's supposed to be zero, there are analog components in the circuit, and they could be adding just a little resistance to the circuit to make it not be exactly zero. You could print the value of signal out to see what it really is.
The 18.5 ms has to do with how long it takes the control signals from the transmitter to get to the master CPU. The signals from the transmitters are PWM with a fixed length channel. On my wiki there is the following note that I've copied from someone named Tinkerman.
Quote:
The measured separation pulse (high pulse) is a fixed 400usec long. Pushing the stick up shortens the channel's "low" pulse about 400usec.
Pushing the stick down lengthens the pulse about 420usec.
No deflection on the stick gives a 1.12msec low pulse (for a total of 1.52msec from the beginning of the separation pulse.)
Every five counts of channel trim adjusts the pulse length 6usec. Minus trim values shorten the "low" pulse time. The top button (chans. 5 and 6) shortens the "low" pulse time 560usec and the bottom button lengthens the "low" pulse 560usec. Each packet of 6 channels repeats roughly every 18.5msec.
|
Edited: I found Tinkerman's orginal article and there are links in it that may be useful.
http://www.vexfan.com/viewtopic.php?t=227