当前位置:网站首页>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
边栏推荐
- Redisson high performance redis distributed lock source code analysis
- Rk1126 platform project summary
- 515. 在每个树行中找最大值
- 【Zuul】com.netflix.zuul.exception.ZuulException: Hystrix Readed time out
- Yingguang MCU development case
- 阿里云子账户 - 权限策略 - 授权给某个账户某个 OSS Bucket 的完全控制权限
- Redisson 高性能 Redis 分布式锁源码分析
- How to download wechat payment certificate (API certificate)
- 应广单片机开发 工规 PMC131 带AD芯片检测电池电压单片机SOP8/14
- Hbuilderx runs to the mobile phone or simulator and prompts that the device is not found
猜你喜欢
【Golang | gRPC】使用gRPC实现简单远程调用
EdgeNeXt打出了一套混合拳:集CNN与Transformer于一体的轻量级架构
Deep understanding of ThreadLocal
Outsourcing for five years, abandoned
ORA-19838 -- 恢复控制文件到备库
MySQL --- 数据库的基本操作
[how to connect the network] Chapter 5 explore the server
wait_for_gap -- 从主库归档备库恢复归档
Redisson 高性能 Redis 分布式锁源码分析
深入理解ThreadLocal
随机推荐
ASEMI整流桥UMB10F参数,UMB10F规格,UMB10F封装
Mysql - opérations de base de la base de données
Laravel文档阅读笔记-Custom Authentication Login And Registration Using Laravel 8
Hbuilderx runs to the mobile phone or simulator and prompts that the device is not found
MySQL --- 数据库的基本操作
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
Unified interface for reading and writing data files in xml/json/ini and ubjson formats
开发一个禁止删除namespace的控制器
应广单片机开发调试应注意的问题
wait_for_gap -- 从主库归档备库恢复归档
1288_FreeRTOS中vTaskResume()接口以及中断安全版本接口实现分析
win10 kms activator
My creation anniversary
567. Arrangement in string
Daily question - "number of daffodils"
Yingguang single chip microcomputer development specification pmc131 with AD chip to detect battery voltage single chip microcomputer sop8/14
【曆史上的今天】7 月 2 日:BitTorrent 問世;商業系統 Linspire 被收購;索尼部署 PlayStation Now
JDBC
能解决 80% 故障的排查思路
Finally detailed explanation