Android 4针双极升压电机

Android things with 4 pin Bi polar step up motor

使用android东西(Pico i.MX7D I/O)如何控制 4 针双极步进电机。你能帮我解决一下引脚配置吗? This is my set up

有谁知道升压电机的请帮帮我...

这一定是代码... 如果有小伙伴需要试试这个

public class mySampleStepper extends AppCompatActivity {

Button button_forward,button_backward;
private static final String[] leftMotorPins = { "GPIO_10", "GPIO_35", "GPIO_33", "GPIO_128" };
private ULN2003 mLeftStepper;
private int minSpeed=100;
StepDuration stepDuration;


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_my_sample_stepper);
    button_backward=findViewById(R.id.button_forward_ID);
    button_forward=findViewById(R.id.button_backward_ID);

     stepDuration = new StepDuration(0, minSpeed);

    try {
        mLeftStepper = new ULN2003(leftMotorPins[0], leftMotorPins[1], leftMotorPins[2], leftMotorPins[3]);
        mLeftStepper.open();

    } catch (Exception e) {
        Log.e(MainActivity.TAG, "Error opening steppers", e);
    }

    button_forward.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mLeftStepper.setDirection(Direction.CLOCKWISE);
            mLeftStepper.performStep(stepDuration);
        }
    });
    button_backward.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mLeftStepper.setDirection(Direction.COUNTERCLOCKWISE);
            mLeftStepper.performStep(stepDuration);
        }
    });


}

@Override
protected void onDestroy() {
    super.onDestroy();
    try {
        mLeftStepper.close();
    } catch (Exception e) {
        Log.e(MainActivity.TAG, "Error opening steppers", e);
    }
}

}

引脚配置

我在 android 东西和步进电机之间使用步进驱动器(L293D 驱动器)。

引脚连接

  • GPIO_10 连接到 c1b(在 L293D 驱动器上)
  • GPIO_35 连接到 c2a
  • GPIO_33 连接到 c1a
  • GPIO_128 连接到 c2b

  • 输出1、输出2、输出3、输出4分别到步进电机

编码愉快:)