Hi Synn,
I'm happy you're making a brave attempt to use the new library!

I think you forgot to set stepperDirCue_.clk, not sure if this is the only
problem.

A few suggestions that can hopefully make your work more effective:

   1. When you ask a question, please provide more information on *what* is
   not working. Just saying that the program is not working makes it very hard
   to help you.
   2. If your program crashes, and in some other cases too, the logcat
   output (open the Logcat view in Eclipse or type adb logcat in the command
   shell) might have useful information to help you figure out what's wrong.
   Use it.
   3. You can add your own log messages in your code, to help you figure
   out what it's doing, where it's stuck, etc.
   4. You can use step-by-step debugging for even deeper understanding of
   what's going on.
   5. Try to simplify your program as much as possible for isolating a
   problem. The program that you sent is a very good example for that!
   6. Try to isolate electrical issues from software issues using an
   oscilloscope or a logic analyzer if you have them, or otherwise by testing
   your program against known-good peripherals (for example, replace motor
   drivers with LEDs, or first check your electronics manually).



On Tue, Jan 21, 2014 at 7:33 PM, Synn Yong Tan <[email protected]> wrote:

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

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