当前位置:网站首页>A4988与42步进电机
A4988与42步进电机
2022-07-02 16:17:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
A4988电机驱动板引脚
VMOT:电源正(8~35V),供电机 GND:电机接地 2B,2A:电机绕组2控制引脚 1A.1B:电机绕组1控制引脚 VDD:驱动板电源正(3~5V) GND:驱动板地 ENABLE:引脚低电平,A4988才能进行电机驱动工作(悬空为默认状态,可以正常工作),高电平,A4988将不会经行电机驱动工作 MS1,MS2,MS3:用来改变驱动模式具体如图 REST:低电平有效,A4988将经行复位,默认为高,可以正常工作 SLEEP:低电平经行低能耗睡眠状态,无需使用时可与REST连接,则保持正常工作不会进入低能耗状态。 STEP:步进引脚,根据脉冲经行动作 DIR:方向引脚,低:顺时针,高:逆时针
A46988使用之前要进行电压调节
电压=最大电流(电机电流)X A4988电阻 X8(本案例v=1.50.18=1.2) 一般电阻为0.05欧,0.1欧,0.2欧 电位器调节电压:顺时针调大,逆时针调小(可用万用表测电位器与接地端)
本次试验用arduino开发板
程序一:顺时针旋转一圈,逆时针快速旋转2圈
// 定义电机控制用常量
// A4988连接Arduino引脚号
const int dirPin = 2; // 方向引脚
const int stepPin = 3; // 步进引脚
// 电机每圈步数
const int STEPS_PER_REV = 200;
void setup() {
// Arduino控制A4988步进和方向的引脚为输出模式
pinMode(stepPin,OUTPUT);
pinMode(dirPin,OUTPUT);
}
void loop() {
// 设置电机顺时针旋转
digitalWrite(dirPin,LOW);
// 电机慢速旋转
for(int x = 0; x < STEPS_PER_REV; x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(2000); //延迟2000微秒delayMicroseconds最多16383
digitalWrite(stepPin,LOW);
delayMicroseconds(2000);
}
// 等待一秒
delay(1000);
// 设置电机逆时针旋转
digitalWrite(dirPin,HIGH);
// 电机快速旋转
for(int x = 0; x < (STEPS_PER_REV * 2); x++) {
digitalWrite(stepPin,HIGH);
delayMicroseconds(1000);
digitalWrite(stepPin,LOW);
delayMicroseconds(1000);
}
// 等待一秒
delay(1000);
}发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/148253.html原文链接:https://javaforall.cn
边栏推荐
- Deep understanding of ThreadLocal
- Modbus协议通信异常
- 把xshell連接服務器關掉,運行的jar包就自動停止的解决方案
- Solution pour arrêter automatiquement les paquets Jar en cours d'exécution en éteignant le serveur de connexion xshell
- Mb10m-asemi rectifier bridge mb10m
- Huimang micro IO MCU ft60f011a-rb
- 【Zuul】com.netflix.zuul.exception.ZuulException: Hystrix Readed time out
- Modbus protocol communication exception
- Turn off the xshell connection server and the running jar package will stop automatically
- 王者荣耀商城异地多活架构设计
猜你喜欢

WPS inserts a picture and displays it completely

【Golang | gRPC】使用openssl生成证书
![[nonlinear control theory]7_ High gain and High Frequency](/img/e5/6c5ca4a89c97d9613cddccb281b35b.png)
[nonlinear control theory]7_ High gain and High Frequency

Laravel文档阅读笔记-Custom Authentication Login And Registration Using Laravel 8

finally详解

详解Kubernetes网络模型

Mysql - opérations de base de la base de données

应广单片机开发 工规 PMC131 带AD芯片检测电池电压单片机SOP8/14
![[target tracking] |siamfc](/img/40/3419761d2eb7f1193b699cdd431761.png)
[target tracking] |siamfc

Mb10m-asemi rectifier bridge mb10m
随机推荐
Solution pour arrêter automatiquement les paquets Jar en cours d'exécution en éteignant le serveur de connexion xshell
In Linux, MySQL sets the job task to start automatically
MySQL --- 数据库的基本概念
php获取两个时间戳之间相隔多少天多少小时多少分多少秒
原装应广单片机 MCU芯片PMS152 SOP8封装 单片机开发
Pfc232-sop8/14/16 should be wide-ranging and can be tape programmed with burning program
MySQL --- 數據庫的基本操作
Huimang micro IO MCU ft60f010a-urt
详解Kubernetes网络模型
567. Arrangement in string
应广单片机开发案例
Modbus协议通信异常
自定义一个loading指令
EdgeNeXt打出了一套混合拳:集CNN与Transformer于一体的轻量级架构
如何下载微信支付证书(API证书)
[golang | grpc] use grpc to realize simple remote call
Huimang micro IO MCU ft60f011a-rb
【历史上的今天】7 月 2 日:BitTorrent 问世;商业系统 Linspire 被收购;索尼部署 PlayStation Now
深入理解ThreadLocal
[how is the network connected] Chapter 4 explores access networks and network operators