aytwartoofyoroo

51stc15WS104 controls ULN2003A stepper motor

 
Overview

Imitate Taobao's board and make an open source project to facilitate everyone's research and use. The board is minimized. , I found a lot of ULN2003 boards on the Internet, and there are a lot of miscellaneous circuits in them, which is not what we want at all. This is the simplest one. You can directly copy and paste it, which is very convenient.

#include <Arduino.h>

#define A1 2            //引脚命名
#define B1 3
#define C1 4
#define D1 5

void setup()
{
    pinMode(A1,OUTPUT);     //设置引脚为输出引脚
    pinMode(B1,OUTPUT);
    pinMode(C1,OUTPUT);
    pinMode(D1,OUTPUT);
}

void loop()
{
    Phase_A();          //设置A相位
    delay(2);           //改变延时可改变旋转速度

    Phase_B();          //设置B相位
    delay(2);      //改变延时可改变旋转速度

    Phase_C();          //设置C相位
    delay(2);      //改变延时可改变旋转速度

    Phase_D();          //设置D相位
    delay(2);      //改变延时可改变旋转速度

}

void Phase_A()
{
    digitalWrite(A1,HIGH);      //A1引脚高电平   
    digitalWrite(B1,LOW);
    digitalWrite(C1,LOW);
    digitalWrite(D1,LOW);
}

void Phase_B()
{
    digitalWrite(A1,LOW);   
    digitalWrite(B1,HIGH);      //B1引脚高电平   
    digitalWrite(C1,LOW);
    digitalWrite(D1,LOW);
}

void Phase_C()
{
    digitalWrite(A1,LOW);   
    digitalWrite(B1,LOW);
    digitalWrite(C1,HIGH);      //C1引脚高电平   
    digitalWrite(D1,LOW);
}

void Phase_D()
{
    digitalWrite(A1,LOW);   
    digitalWrite(B1,LOW);
    digitalWrite(C1,LOW);
    digitalWrite(D1,HIGH);      //D1引脚高电平   
}
 
 
Search Datasheet?

Supported by EEWorld Datasheet

Forum More
Update:2025-06-24 13:42:47

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
community

Robot
development
community

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号