一.系统概述
使用作为主控 , 驱动是 , 驱动五线四相步进电机 。
(1)五相步进电机工程图
文章插图
(2)驱动电路原理图
二.代码部分
#define D1 5#define D2 4#define D3 0#define D4 2#define DSD 5void setup() {// put your setup code here, to run once:pinMode(5,OUTPUT);pinMode(4,OUTPUT);pinMode(0,OUTPUT);pinMode(2,OUTPUT);pinMode(14,INPUT_PULLUP);pinMode(12,INPUT_PULLUP);}void loop() {// put your main code here, to run repeatedly:if(digitalRead(14)!=1){clockward90();}if(digitalRead(12)!=1){cclockward90();}}void clockward90(){for(int i=1;i<=128;i++){delay(DSD);phaseA();delay(DSD);phaseAB();delay(DSD);phaseB();delay(DSD);phaseBC();delay(DSD);phaseC();delay(DSD);phaseCD();delay(DSD);phaseD();delay(DSD);phaseDA();}phaseZero();}void cclockward90(){for(int i=1;i<=128;i++){delay(DSD);phaseDA();delay(DSD);phaseD();delay(DSD);phaseCD();delay(DSD);phaseC();delay(DSD);phaseBC();delay(DSD);phaseB();delay(DSD);phaseAB();delay(DSD);phaseA();}phaseZero();}void phaseA(){digitalWrite(5,HIGH);digitalWrite(4,LOW);digitalWrite(0,LOW);digitalWrite(2,LOW);}void phaseB(){digitalWrite(5,LOW);digitalWrite(4,HIGH);digitalWrite(0,LOW);digitalWrite(2,LOW);}void phaseC(){digitalWrite(5,LOW);digitalWrite(4,LOW);digitalWrite(0,HIGH);digitalWrite(2,LOW);}void phaseD(){digitalWrite(5,LOW);digitalWrite(4,LOW);digitalWrite(0,LOW);digitalWrite(2,HIGH);}void phaseAB(){digitalWrite(5,HIGH);digitalWrite(4,HIGH);digitalWrite(0,LOW);digitalWrite(2,LOW);}void phaseBC(){digitalWrite(5,LOW);digitalWrite(4,HIGH);digitalWrite(0,HIGH);digitalWrite(2,LOW);}void phaseCD(){digitalWrite(5,LOW);digitalWrite(4,LOW);digitalWrite(0,HIGH);digitalWrite(2,HIGH);}void phaseDA(){digitalWrite(5,HIGH);digitalWrite(4,LOW);digitalWrite(0,LOW);digitalWrite(2,HIGH);}void phaseZero(){digitalWrite(5,LOW);digitalWrite(4,LOW);digitalWrite(0,LOW);digitalWrite(2,LOW);}
文章插图
三.工作情况
实验情况:工作稳定,满足需要 。电机很便宜,工作也很稳定 。就是转的有点慢 。
【ESP8266驱动五线四相步进电机】每次按下按钮,步进电机顺时针/逆时针旋转90°,接下来步进电机的所有输入INT引脚打高 , 步进电机内部线圈此时不通过电流,来减小步进电机在待机状态下的发热 。
- 电脑更新驱动后分辨率不对 更新驱动不能调分辨率
- 映美打印机怎么安装驱动 映美打印机怎么安装
- GVS发布华尔兹智能面板,用户体验驱动智能家居产品设计
- 怎么查看电脑驱动是否缺失 查看电脑缺少的驱动程序
- 直流有刷减速电机驱动板电流电压采集
- 怎么安装手机驱动 电脑怎么安装手机驱动
- win7系统声卡两个驱动 Win7声卡驱动
- Win10 在Windows 10下安装“NVIDIA图形驱动程序
- 五线谱音位有几个 五线谱上有几个音位
- 电脑如何更新显卡驱动 笔记本电脑如何更新显卡驱动