Thanks, looked for an answer for this for a while :) On Thursday, April 4, 2013 8:34:24 AM UTC+3, Ytai wrote: > > Servos like PWM signals with 50Hz frequencies and 1ms-2ms pulse width. > You're way out of both :) > See IOIOSimpleApp as a servo example. > > > On Wed, Apr 3, 2013 at 3:49 PM, Imran Ismail <[email protected]<javascript:> > > wrote: > >> Hi good sirs, i'm currently learning how to code with android and >> ioiolib, but after meddling for two days... all i could do was hello world >> and digitaloutput for a couple of LEDs hooked up together >> >> >> I'm trying to power up a servo, tried different frequencies to no avail, >> tried normal mode (not open drain) still doesn't work... >> >> I'm down to trying the most simple kind of code i could do >> >> AND YET IT STILL DOESN'T WORK >> >> Please help me, it's urgent as i'm learning this for my final year project >> >> Specs and Settings >> >> IOIO v1 >> Galaxy Ace w/ Android v2.3.5 (CM7) >> LED (Anode to pin 7, Cathode to GRND) >> 5v DC to VIN >> >> >> Code >> >> package ioio.examples.hello; >>> >>> import ioio.lib.api.DigitalOutput; >>> >>> import ioio.lib.api.DigitalOutput.Spec.Mode; >>> >>> import ioio.lib.api.PwmOutput; >>> >>> import ioio.lib.api.exception.ConnectionLostException; >>> >>> import ioio.lib.util.BaseIOIOLooper; >>> >>> import ioio.lib.util.IOIOLooper; >>> >>> import ioio.lib.util.android.IOIOActivity; >>> >>> import android.os.Bundle; >>> >>> import android.widget.ToggleButton; >>> >>> >>> public class MainActivity extends IOIOActivity { >>> >>> private ToggleButton button_; >>> >>> >>> @Override >>> >>> public void onCreate(Bundle savedInstanceState) { >>> >>> super.onCreate(savedInstanceState); >>> >>> setContentView(R.layout.main); >>> >>> button_ = (ToggleButton) findViewById(R.id.button); >>> >>> } >>> >>> >>> class Looper extends BaseIOIOLooper { >>> >>> /** The on-board LED. */ >>> >>> private DigitalOutput led_; >>> >>> private PwmOutput servo; >>> >>> @Override >>> >>> protected void setup() throws ConnectionLostException { >>> >>> led_ = ioio_.openDigitalOutput(0, true); >>> >>> servo = ioio_.openPwmOutput(new DigitalOutput.Spec(7, Mode.OPEN_DRAIN), >>> 1000); >>> >>> servo.setDutyCycle(0.5f); // 50% intensity >>> >>> try { >>> >>> Thread.sleep(500); >>> >>> } catch (InterruptedException e) { >>> >>> Thread.currentThread().interrupt(); >>> >>> } >>> >>> servo.setDutyCycle(1f); // 100% intensity >>> >>> } >>> >>> >>> @Override >>> >>> public void loop() throws ConnectionLostException { >>> >>> led_.write(!button_.isChecked()); >>> >>> try { >>> >>> Thread.sleep(100); >>> >>> } catch (InterruptedException e) { >>> >>> } >>> >>> } >>> >>> } >>> >>> >>> @Override >>> >>> protected IOIOLooper createIOIOLooper() { >>> >>> return new Looper(); >>> >>> } >>> } >> >> -- >> 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] <javascript:>. >> To post to this group, send email to [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/ioio-users?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > >
-- 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/groups/opt_out.
