当前位置:网站首页>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
边栏推荐
- 应广单片机(MCU单片机科普)
- 能解决 80% 故障的排查思路
- Songhan sn8p2511 sop8 single chip microcomputer can be used for burning, providing single chip microcomputer scheme development and single chip microcomputer decryption
- Android cycle timer implementation, to achieve fixed Android cache cleaning
- Calculation of favorable comment rate
- 【历史上的今天】7 月 2 日:BitTorrent 问世;商业系统 Linspire 被收购;索尼部署 PlayStation Now
- Viewing technological changes through Huawei Corps (VI): smart highway
- EdgeNeXt打出了一套混合拳:集CNN与Transformer于一体的轻量级架构
- In Linux, MySQL sets the job task to start automatically
- MySQL进阶-事务及索引
猜你喜欢

Rk1126 platform project summary

Viewing technological changes through Huawei Corps (VI): smart highway

【Golang | gRPC】使用openssl生成证书

Asemi rectifier bridge umb10f parameters, umb10f specifications, umb10f package

wait_for_gap -- 从主库归档备库恢复归档

Embedded ~ introduction

EdgeNeXt打出了一套混合拳:集CNN与Transformer于一体的轻量级架构

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

Intelligent hydropower meter energy consumption monitoring cloud platform

自定义一个loading指令
随机推荐
How to download wechat payment certificate (API certificate)
MySQL --- 数据库的基本概念
aloam 代码阅读与总结
Use Zadig to build a continuous delivery platform from 0 to 1
D构造函数问题
ASEMI整流桥UMB10F参数,UMB10F规格,UMB10F封装
Virtual lab basic experiment tutorial -7 Polarization (1)
应广单片机开发调试应注意的问题
Yilong em78p153k dip14 MCU
1288_FreeRTOS中vTaskResume()接口以及中断安全版本接口实现分析
Redisson high performance redis distributed lock source code analysis
把xshell连接服务器关掉,运行的jar包就自动停止的解决方案
Android cycle timer implementation, to achieve fixed Android cache cleaning
Redisson 高性能 Redis 分布式锁源码分析
Troubleshooting ideas that can solve 80% of faults
Huimang micro IO MCU ft60f11f-mrb
Pms150c Yingguang MCU development case
Longest non repeating subarray
977.有序数组的平方
Yingguang single chip microcomputer (MCU popular science)