当前位置:网站首页>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芯片PMS152 SOP8封装 单片机开发
- Bluetooth technology | new working mode of wearable devices of the Internet of things, and Bluetooth ble helps the new working mode
- MySQL安装与配置
- JDBC
- WPS inserts a picture and displays it completely
- 蓝牙技术|物联网的可穿戴设备新工作模式,蓝牙BLE助力新工作模式
- Huimang micro IO MCU ft60f11f-mrb
- 外包干了五年,废了...
- 应广单片机开发流程需要注意哪些?
- Design of the multi live architecture in different places of the king glory mall
猜你喜欢

Freemaker+poi realizes dynamic generation and parsing of Excel files

我的创作纪念日

台湾飞凌FM8PB513B单片机提供单片机方案开发 产品设计

Explain kubernetes network model in detail

深入理解ThreadLocal

Larvel document reading notes custom authentication login and registration using larvel 8

Aloam code reading and summary

Modbus protocol communication exception

Yingguang single chip microcomputer development specification pmc131 with AD chip to detect battery voltage single chip microcomputer sop8/14

wait_for_gap -- 从主库归档备库恢复归档
随机推荐
深入理解ThreadLocal
台风来袭,多景区暂时关闭,省文旅厅提醒注意安全!
Virtual lab basic experiment tutorial -7 Polarization (2)
Modbus协议通信异常
MySQL --- 数据库的基本概念
Huimang micro IO MCU ft60f010a-urt
[nonlinear control theory]8_ Comparison of three robust controllers
Two pieces of nature a day! Duan Fengfeng, an alumnus of the University of science and technology of China, was the third Chinese winner of the belby medal
567.字符串中的排列
把xshell連接服務器關掉,運行的jar包就自動停止的解决方案
Pfc232-sop8/14/16 should be wide-ranging and can be tape programmed with burning program
【Golang | gRPC】使用gRPC实现简单远程调用
Chapter 15 string localization and message Dictionary (1)
JDBC
567. Arrangement in string
PHP gets the number of days, hours, minutes and seconds between the two timestamps
[how to connect the network] Chapter 5 explore the server
应广单片机PMS150/PMC150/PMS150C消费类单片机
PMS150C应广单片机开发案例
Troubleshooting ideas that can solve 80% of faults