当前位置:网站首页>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
鸟鸣涧 唐朝·王维 |
---|
人闲桂花落,夜静春山空。 |
---|
月出惊山鸟,时鸣春涧中。 |
---|
边栏推荐
- [exercise] HashSet
- Oracle physical architecture
- Actual combat of flutter - fast implementation of audio and video call application
- Hls4ml reports an error the board_ part definition was not found for tul. com. tw:pynq-z2:part0:1.0.
- 为定时器和延时器等其它情况的回调函数绑定当前作用域的this
- Interview questions shared in today's group
- torch. nn. functional. Interpolate function
- The large list set is divided into multiple small list sets in equal proportion
- 对象的创建
- list大集合等比分割成多个小list集合
猜你喜欢
今日群里分享的面试题
GC garbage collection
[research materials] iResearch tide Watching: seven major trends in the clothing industry - Download attached
Cookie和Session的相关概念
Example explanation: move graph explorer to jupyterlab
Win11快捷键切换输入法无反应怎么办?快捷键切换输入法没有反应
Actual combat of flutter - fast implementation of audio and video call application
GaussDB(for MySQL) :Partial Result Cache,通过缓存中间结果对算子进行加速
Uni app wechat applet one click login to obtain permission function
Leetcode 1380 lucky numbers in matrix [array] the leetcode path of heroding
随机推荐
Cookie和Session的相关概念
MySQL reports an error can't create table 'demo01 tb_ Student‘ (errno: 150)*
Unreal Engine packaging project
【多线程】锁策略
【AI服务器搭建】CUDA环境
PowerDesigner design name and comment replacement
qobject_ Cast usage
安装sharp报错
torch. nn. functional. Interpolate function
EasyCVR通过国标GB28181协议接入设备,出现设备自动拉流是什么原因?
Optaplanner learning notes (I) case cloud balance
Time series analysis using kibana timelion
Bind this of the current scope for callback functions in other cases such as timers and delayers
开发那些事儿:EasyCVR集群设备管理页面功能展示优化
mysql 报错 Can‘t create table ‘demo01.tb_Student‘ (errno: 150)*
Easycvr accesses the equipment through the national standard gb28181 protocol. What is the reason for the automatic streaming of the equipment?
servlet知识点
Analysis of GetMessage underlying mechanism
Why must we move from Devops to bizdevops?