I'm trying to connect IOIO board with 2 DC motor using arduino motor shield 
with external 9V battery. Seems like everything is working when i check my 
ioio output with led. but the motor wont budge when i connect it with the 
shield. Is the shield not compatible with IOIO? or some other problems?
 My coding:

package ioio.examples.hello;

import ioio.lib.api.DigitalOutput;
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 ioio.lib.api.Sequencer;
import ioio.lib.api.Sequencer.ChannelConfig;
import ioio.lib.api.Sequencer.ChannelConfigPwmSpeed;
import ioio.lib.api.Sequencer.ChannelCuePwmSpeed;

public class MainActivity extends IOIOActivity {
 @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
 }

class Looper extends BaseIOIOLooper {
 private Sequencer.ChannelCuePwmSpeed dcMotorACue_ = new 
ChannelCuePwmSpeed();
private Sequencer.ChannelCuePwmSpeed dcMotorBCue_ = new 
ChannelCuePwmSpeed();
 private Sequencer.ChannelCue[] cue_ = new Sequencer.ChannelCue[] 
{dcMotorACue_, dcMotorBCue_ };
private Sequencer sequencer_;

@Override
protected void setup() throws ConnectionLostException, InterruptedException 
{
 DigitalOutput enable1 = ioio_.openDigitalOutput(3);
DigitalOutput enable2 = ioio_.openDigitalOutput(4);
enable2.write(true);
enable1.write(true);
final ChannelConfigPwmSpeed dcMotorAConfig = new 
Sequencer.ChannelConfigPwmSpeed(
Sequencer.Clock.CLK_2M, 2000, 0, new DigitalOutput.Spec(1));
final ChannelConfigPwmSpeed dcMotorBConfig = new 
Sequencer.ChannelConfigPwmSpeed(
Sequencer.Clock.CLK_2M, 2000, 0, new DigitalOutput.Spec(2));
final ChannelConfig[] config = new ChannelConfig[] {dcMotorAConfig, 
dcMotorBConfig };
 sequencer_ = ioio_.openSequencer(config);

// Pre-fill.
sequencer_.waitEventType(Sequencer.Event.Type.STOPPED);

sequencer_.start();
 }

@Override
public void loop() throws ConnectionLostException, InterruptedException {
push();
}
private void push() throws ConnectionLostException, InterruptedException {
dcMotorACue_.pulseWidth = 1000;
dcMotorBCue_.pulseWidth = 1000;
sequencer_.push(cue_, 62500);
}

/**
 * A method to create our IOIO thread.
 * 
 * @see ioio.lib.util.AbstractIOIOActivity#createIOIOThread()
 */
 }
protected IOIOLooper createIOIOLooper() {
return new Looper();
}}

On Friday, April 4, 2014 12:59:05 PM UTC+8, Chia Waicheong wrote:
>
> Bought an IOIO-OTG and it was working well until the yellow led started to 
> blink when i connect it with a 9V battery. Now, it cant even detected by my 
> computer via USB. Can anyone provide some suggestions?
>
>

-- 
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