Hi,
I'm trying to do control on step motor. 
My app didn't working but i cannot find out where is the problem.
Can please help me to see the code?

package ioio.examples.simple;

import ioio.lib.api.DigitalOutput;

import ioio.lib.api.Sequencer;
import ioio.lib.api.Sequencer.ChannelConfig;
import ioio.lib.api.Sequencer.ChannelConfigBinary;
import ioio.lib.api.Sequencer.ChannelConfigSteps;
import ioio.lib.api.Sequencer.ChannelCueBinary;
import ioio.lib.api.Sequencer.ChannelCueSteps;
import ioio.lib.api.exception.ConnectionLostException;
import ioio.lib.util.BaseIOIOLooper;
import ioio.lib.util.IOIOLooper;
import android.os.Bundle;
import ioio.lib.util.android.IOIOActivity;
import android.widget.ToggleButton;




public class IOIOSimpleApp extends IOIOActivity {
private ToggleButton toggleButton_;

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
toggleButton_ = (ToggleButton) findViewById(R.id.ToggleButton);

}

class Looper extends BaseIOIOLooper {
 private Sequencer.ChannelCueBinary stepperDirCue_ = new ChannelCueBinary();
private Sequencer.ChannelCueSteps stepperStepCue_ = new ChannelCueSteps();
private Sequencer.ChannelCue[] cue_ = new Sequencer.ChannelCue[] 
{stepperDirCue_, stepperStepCue_ };

private Sequencer sequencer_;

 @Override
protected void setup() throws ConnectionLostException, InterruptedException 
{
 final ChannelConfigBinary stepperDirConfig = new 
Sequencer.ChannelConfigBinary(
false, false, new DigitalOutput.Spec(3));
final ChannelConfigSteps stepperStepConfig = new ChannelConfigSteps(
new DigitalOutput.Spec(4));
final ChannelConfig[] config = new ChannelConfig[] {  stepperDirConfig,
stepperStepConfig };

sequencer_ = ioio_.openSequencer(config);

push();
 sequencer_.start();
}


@Override
public void loop() throws ConnectionLostException, InterruptedException {
push();
}

private void push() throws ConnectionLostException, InterruptedException  {
 stepperStepCue_.pulseWidth = 2;
 stepperStepCue_.period = 400;

boolean on = (toggleButton_.isChecked());
 if (on) {
 
 stepperDirCue_.value = true;
 
    } else {
     stepperDirCue_.value = false; 
    }
 sequencer_.push(cue_, 62500 / 2);
}
}

@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].
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.

Reply via email to