HI, Ytai. I tried my app with oscilloscope. The dir pin is able to work
when i connect it to a led and also tried it with oscilloscope.
The problem is there is no pulse output from the step pin after i connected
it to oscilloscope. I tried to look over the code but i can't find out
where is the problem.


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.Sequencer.Clock;
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,DigitalOutput.Spec.Mode.OPEN_DRAIN));
final ChannelConfigSteps stepperStepConfig = new ChannelConfigSteps(
new DigitalOutput.Spec(4,DigitalOutput.Spec.Mode.OPEN_DRAIN));


final ChannelConfig[] config = new ChannelConfig[] {  stepperDirConfig,
stepperStepConfig
};
sequencer_ = ioio_.openSequencer(config);
sequencer_.waitEventType(Sequencer.Event.Type.STOPPED);
while (sequencer_.available() > 0) {
push();
}


sequencer_.start();
}



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

private void push() throws ConnectionLostException, InterruptedException  {
 if (toggleButton_.isChecked()) {

 stepperDirCue_.value = true;
 stepperStepCue_.clk = Clock.CLK_2M;
stepperStepCue_.pulseWidth = 2;
stepperStepCue_.period = 400;


    } else {
     stepperDirCue_.value = false;
     stepperStepCue_.clk = Clock.CLK_2M;
stepperStepCue_.pulseWidth = 2;
stepperStepCue_.period = 400;
    }
 sequencer_.push(cue_, 62500 / 200);
}
}

@Override
protected IOIOLooper createIOIOLooper() {
return new Looper();
}
 }



On Wed, Jan 22, 2014 at 4:14 PM, Ytai Ben-Tsvi <[email protected]> wrote:

> Please read my last email again
> On Jan 21, 2014 10:34 PM, "Synn Yong Tan" <[email protected]> wrote:
>
>> Hi, Ytai..
>> Sorry because i not really get the command you meant..
>> You meant stepperStepCue.clk  or  stepperDirCue_.clk?
>> Actually the app is successfully built. But after i connect everything
>> together, the motor is not even rotating.
>> By the way, the output signal voltage is only 3.3v, right? I have to use
>> the open-drain mode so that i can send 5v output signal.. is that right?
>>
>>
>> On Wed, Jan 22, 2014 at 2:16 PM, Ytai Ben-Tsvi <[email protected]> wrote:
>>
>>> 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 a topic in the
>>> Google Groups "ioio-users" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/ioio-users/jxhTI2gAhMk/unsubscribe.
>>> To unsubscribe from this group and all its topics, 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.
>>
>  --
> You received this message because you are subscribed to a topic in the
> Google Groups "ioio-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/ioio-users/jxhTI2gAhMk/unsubscribe.
> To unsubscribe from this group and all its topics, 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