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引脚高电平
}
All reference designs on this site are sourced from major semiconductor manufacturers or collected online for learning and research. The copyright belongs to the semiconductor manufacturer or the original author. If you believe that the reference design of this site infringes upon your relevant rights and interests, please send us a rights notice. As a neutral platform service provider, we will take measures to delete the relevant content in accordance with relevant laws after receiving the relevant notice from the rights holder. Please send relevant notifications to email: bbs_service@eeworld.com.cn.
It is your responsibility to test the circuit yourself and determine its suitability for you. EEWorld will not be liable for direct, indirect, special, incidental, consequential or punitive damages arising from any cause or anything connected to any reference design used.
Supported by EEWorld Datasheet