I started an IOIO app from the HelloIOIO sample, and converted the "turn 
the light on or off" button to a "send a PWM signal" button so it could 
drive a servomotor.

With minimal changes, the code works beautifully: (Excerpt from void loop())

            if (button_.isChecked()) {
                pwm.setDutyCycle(0.5f); // Don't spin.
            } else {
                pwm.setDutyCycle(1.0f); // Do spin.
            }

But once I no longer key the pwm off the button, it fails. Making this 
trivial change, which I would expect to spin the motor always, prevents the 
motor from spinning ever:

            if (false) {
                pwm.setDutyCycle(0.5f); // Never reach here. Never stop.
            } else {
                pwm.setDutyCycle(1.0f); // Always choose this. Always spin.
            }

Can anyone point out what I'm missing?

- - - - - - - - - - - - 

Originally posted on StackOverflow, here 
<http://stackoverflow.com/questions/26032111/pwm-on-ioio-works-when-tied-to-a-button-fails-always-when-independent-of-button>
.

-- 
You received this message because you are subscribed to the Google Groups 
"ioio-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/ioio-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to