当前位置:网站首页>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
| 鸟鸣涧 唐朝·王维 |
|---|
| 人闲桂花落,夜静春山空。 |
|---|
| 月出惊山鸟,时鸣春涧中。 |
|---|
边栏推荐
- Axure does not display catalogs
- 【无标题】
- CMU AI PhD first year summary
- Optaplanner learning notes (I) case cloud balance
- HLS4ML报错The board_part definition was not found for tul.com.tw:pynq-z2:part0:1.0.
- Uni app wechat applet one click login to obtain permission function
- 新窗口打开页面-window.open
- JS的Proxy
- 今日群里分享的面试题
- torch. nn. functional. Interpolate function
猜你喜欢

Optaplanner learning notes (I) case cloud balance

SQL 入门计划-1-选择

Regular expression =regex=regular expression

毕业季 | 华为专家亲授面试秘诀:如何拿到大厂高薪offer?

GC垃圾回收

Mo Tianlun salon | Tsinghua qiaojialin: Apache iotdb, originated from Tsinghua, builds an open source ecological road

STC 32位8051单片机开发实例教程 二 I/O工作模式及其配置

Hls4ml entry method

JVM memory model

再回顾集合容器
随机推荐
Win11如何取消任务栏隐藏?Win11取消任务栏隐藏的方法
安装sharp报错
Compile ffmpeg source code with msys+vs2019 under win10
mysql 報錯 Can‘t create table ‘demo01.tb_Student‘ (errno: 150)*
Simplified pinduoduo product data
JS ternary expression complex condition judgment
Interview question 16.16 Partial sorting - Double finger needling
New window open page -window open
SQL getting started plan-1-select
SwiftUI 4 新功能大全之 Toggle与 Mixed Toggle 多个绑定组件
Modsim basic use (Modbus simulator)
[research materials] national second-hand housing market monthly report January 2022 - Download attached
[exercise] HashSet
JS proxy
IPv4 address, subnet mask, gateway
JVM内存模型
GC garbage collection
GC垃圾回收
实例讲解将Graph Explorer搬上JupyterLab