Quote:
|
Originally Posted by teh_pwnerer795
Here is an example of what would happen if you did not restate ur pwm's
NOT DECLARING
if (rc_dig_in01 == 0)
{
pwm01 = 0;
}
(pwm01 would stay at the value 0 when button is pressed. Once its unpressed, the value will stay at 0.)
|
Unless something else assigns a different value to pwm01, that is correct.
Quote:
|
Originally Posted by teh_pwnerer795
DECLARING
if (rc_dig_in01 == 0)
{
pwm01 = 0;
}
(When button is pressed value will be 0. When it is unpressed, the value will be 127 
|
Unless something else assigns a different value to pwm01, that is
wrong.
You seem to be under the impression that "declaring" a variable works some magic that keeps setting it to a specific value. If you want pwm01 to always be 127 when the button is released, you'll have to do it yourself. Either
Code:
pwm01 = 127;
if (rc_dig_in01 == 0)
{
pwm01 = 0;
}
or
Code:
if (rc_dig_in01 == 0)
{
pwm01 = 0;
}
else
{
pwm01 = 127;
}