当前位置:网站首页>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
边栏推荐
- Modbus protocol communication exception
- Yilong em78p153k dip14 MCU
- 应广单片机开发调试应注意的问题
- Yingguang pmc131 SOP16 16pin eight bit MCU
- 能解决 80% 故障的排查思路
- 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
- 应广单片机开发 工规 PMC131 带AD芯片检测电池电压单片机SOP8/14
- POJ - 1458 common subsequence (longest common subsequence)
- Songhan sn8p2511 sop8 single chip microcomputer can be used for burning, providing single chip microcomputer scheme development and single chip microcomputer decryption
- 【Zuul】com.netflix.zuul.exception.ZuulException: Hystrix Readed time out
猜你喜欢
Bluetooth technology | new working mode of wearable devices of the Internet of things, and Bluetooth ble helps the new working mode
应广单片机开发 工规 PMC131 带AD芯片检测电池电压单片机SOP8/14
[how is the network connected] Chapter 6 requests arrive at the server and respond to the client (end)
Daily question - xiaolele changes the number
Larvel document reading notes custom authentication login and registration using larvel 8
WPS inserts a picture and displays it completely
Does pytorch support 32 bits?
Modbus protocol communication exception
wait_ for_ Gap -- restore archive from primary archive to secondary Archive
蓝牙技术|物联网的可穿戴设备新工作模式,蓝牙BLE助力新工作模式
随机推荐
easyAI笔记——机器学习
Yingguang single chip microcomputer development specification pmc131 with AD chip to detect battery voltage single chip microcomputer sop8/14
Larvel document reading notes custom authentication login and registration using larvel 8
Taiwan Feiling fm8pb513b MCU provides MCU program development product design
aloam 代码阅读与总结
Many scenic spots are temporarily closed due to the typhoon. The provincial culture and tourism department reminds you to pay attention to safety!
应广单片机开发案例
Graduation summary
Does pytorch support 32 bits?
MySQL --- 数据库的基本操作
Problems needing attention in the development and debugging of Yingguang single chip microcomputer
基数排序的简单理解
Yingguang pmc131 SOP16 16pin eight bit MCU
[comment le réseau se connecte] chapitre 6: demande d'accès au serveur et réponse au client (terminé)
应广单片机开发 工规 PMC131 带AD芯片检测电池电压单片机SOP8/14
POJ - 1458 common subsequence (longest common subsequence)
567. Arrangement in string
Linux中,mysql设置job任务自动启动
Pfc232-sop8/14/16 should be wide-ranging and can be tape programmed with burning program
Bluetooth technology | new working mode of wearable devices of the Internet of things, and Bluetooth ble helps the new working mode