当前位置:网站首页>Arduino Stepper库驱动28BYJ-48步进电机测试程序
Arduino Stepper库驱动28BYJ-48步进电机测试程序
2022-07-01 18:47:00 【perseverance52】
Arduino Stepper库驱动28BYJ-48步进电机测试程序
- Proteus仿真

步进电机28BYJ-48相关参数
步进电机28BYJ-48,步进角:5.625度,就是1个脉冲信号转5.625度,64个信号转360度。减速比:1/64,电机壳里边的电机转64圈,电机壳外边的部分转1圈。
Stepper库说明
库源代码的驱动的相序是不一样的,为了驱动
28BYJ-48步进电机
- 方式一:定义方式:
Stepper myStepper(motorSteps, 8,10,9,11); - 方式二:对调电机电机线序。(本例采用对调线序)
- 方式三: 修改相关代码如下:
文件位置:C:\Users\Administrator\Documents\Arduino\libraries\Stepper\src,中的Stepper.cpp源文件,第257行-278行,修改如下,就是调整引脚高低电平顺序。

步进电机相关参数
Step Angle该参数决定了,程序运行时,步进电机能否转一圈。

测试功能说明
运行仿真后,步进电机转一圈停止。
示例代码
/* Arduino控制28BYJ-48步进电机测试程序 */
//本示例程序使用Stepper库
#include <Stepper.h>//点击这里会自动打开管理库页面: http://librarymanager/All#Stepper
// 电机外部输出轴旋转一周步数
const int stepsPerRevolution = 64;
// 建立步进电机对象
// 定义电机控制引脚以及电机基本信息。
// 电机控制引脚为 8,9,10,11
// 以上引脚依次连接在ULN2803 驱动板 In1, In2, In3, In4
Stepper steppermotor(stepsPerRevolution, 8, 9, 10, 11);
void setup()
{
Serial.begin(9600);
// set the speed at 60 rpm:
delay(1000);
Serial.println("Start...");
steppermotor.setSpeed(60);
steppermotor.step(128);
Serial.println("Stop...");
delay(1000);
}
void loop()
{
// 慢速顺时针旋转一圈
// steppermotor.setSpeed(60);
// steppermotor.step(128);
// delay(1000);
// 快速逆时针旋转一圈
// steppermotor.setSpeed(60);
// steppermotor.step(128);
// delay(2000);
}
程序源码和仿真资源
本示例基于
Proteus8.12平台。
链接:https://pan.baidu.com/s/10_t4Z3nn6_e_Twm1NHcSpw
提取码:up7u
| 鸟鸣涧 唐朝·王维 |
|---|
| 人闲桂花落,夜静春山空。 |
|---|
| 月出惊山鸟,时鸣春涧中。 |
|---|
边栏推荐
- torch. nn. functional. Interpolate function
- Proxy in ES6
- [research materials] Huawei Technology ICT 2021: at the beginning of the "Yuan" year, the industry is "new" -- download attached
- 118. Yanghui triangle
- [AI server setup] CUDA environment
- 开发那些事儿:EasyCVR集群设备管理页面功能展示优化
- JS 之 常用内置类的使用
- Stack Overflow 2022 开发者调查:行业走向何方?
- 703. The k-th element in the data flow
- Basic use of MySQL
猜你喜欢
随机推荐
JDBC中如何添加事务
qobject_ Cast usage
Servlet knowledge points
Oracle物理体系结构
PowerDesigner design name and comment replacement
DS transunet: Dual Swing transformer u-net for medical image segmentation
开发那些事儿:EasyCVR集群设备管理页面功能展示优化
Gaussdb (for MySQL):partial result cache, which accelerates the operator by caching intermediate results
2022/5/23-2022/5/30
Redis installation and startup in Windows environment (background startup)
JS ternary expression complex condition judgment
一个程序员如何快速成长
HLS4ML进入方法
A quietly rising domestic software, low-key and powerful!
Easycvr accesses the equipment through the national standard gb28181 protocol. What is the reason for the automatic streaming of the equipment?
HLS4ML报错The board_part definition was not found for tul.com.tw:pynq-z2:part0:1.0.
安装sharp报错
Why has instagram changed from a content sharing platform to a marketing tool? How do independent sellers use this tool?
通过js实现金字塔(星号金字塔,回文对称数字金字塔)
Wireshark packet analysis TCP, FTP









