当前位置:网站首页>Arduino controls tb6600 driver +42 stepper motor
Arduino controls tb6600 driver +42 stepper motor
2022-06-13 00:35:00 【Flying husky】


int PUL = 7; // Define the pulse pin
int DIR = 6; // Define direction pins
int ENA = 5; // Define enable pin
int RESET = 4; // Define reset sensor
/**
* TB6600 Driver . 42 Two phase four wire stepping motor
*/
void setup() {
pinMode (PUL, OUTPUT);
pinMode (DIR, OUTPUT);
pinMode (ENA, OUTPUT);
pinMode (RESET,INPUT);
Serial.begin(9600);
// Initialize reset - turn 3 circle
for (int i = 0; i < 4800; i++) // Forward 4800 Step SW1=OFF,SW2=ON,SW3=OFF( Every lap 1600 pulse )
{
digitalWrite(DIR, LOW); // Define forward rotation
digitalWrite(ENA, HIGH);// start-up
digitalWrite(PUL, HIGH);// Output pulse
delayMicroseconds(2000);
digitalWrite(PUL, LOW);
// Reset the sensor
int reset = digitalRead(RESET);
if(c == 0) {
// Stop the rotation after the monitoring reaches the reset position
break;
}
delayMicroseconds(2000);
}
}
void loop() {
for (int i = 0; i < 1600; i++) // Positive rotation 1 circle
{
digitalWrite(DIR, LOW);
digitalWrite(ENA, HIGH);
digitalWrite(PUL, HIGH);
delayMicroseconds(50);
digitalWrite(PUL, LOW);
delayMicroseconds(50);
}
delay(10000); // Pause 10 second
for (int i = 0; i < 1600; i++) // Reverse 1 circle
{
digitalWrite(DIR, HIGH);
digitalWrite(ENA, HIGH);
digitalWrite(PUL, HIGH);
delayMicroseconds(50);
digitalWrite(PUL, LOW);
delayMicroseconds(50);
}
}边栏推荐
- The whole process from entering URL to displaying page (interview)
- Kali system -- dnsrecon for DNS collection and analysis
- [matlab] matrix operation
- Map from getting started to performance optimization
- Penetration test summary
- ucore lab3
- 6.824 Lab 3B: Fault-tolerant Key/Value Service
- 电商员工离职后将产品价格改为1折出售,已被刑拘
- [matlab] basic operation
- [LeetCode]9. Palindromes thirty-two
猜你喜欢

测试平台系列(97) 完善执行case部分
![Buuctf babyupload[gxyctf2019]](/img/e8/202298b64d8764355fad348b50fee6.png)
Buuctf babyupload[gxyctf2019]

Browser cache execution process

Real time preview of PHP in browser by vscade
![[gxyctf2019] no dolls -- detailed explanation](/img/c8/8c588ab8f58e2b38b9c64c4ccd733f.png)
[gxyctf2019] no dolls -- detailed explanation

分公司能与员工签劳动合同么

Map from getting started to performance optimization
![[hcie discussion] STP-A](/img/4f/7a76555fc7b23eafa108699f5aa5ad.png)
[hcie discussion] STP-A
![[CISCN2019 华北赛区 Day2 Web1]Hack World --BUUCTF](/img/1e/ebf8cc06ba620261f03f84ca2c68e6.png)
[CISCN2019 华北赛区 Day2 Web1]Hack World --BUUCTF
![[hcie discussion] multicast igmp-a](/img/1a/74c6e698c9a6a6c7a4c32153a0a277.png)
[hcie discussion] multicast igmp-a
随机推荐
Kalix system - use of information collection gadgets
Explain bio, NiO, AIO in detail
On the parameters of main function in C language
Also on STM32 using dma+ serial port to obtain variable length data
Context of go concurrency mode
6.824 Lab 3B: Fault-tolerant Key/Value Service
[error] invalid use of incomplete type uses an undefined type
Transaction verification of btcd transaction process (2)
String类中split()方法的使用
Kali system -- dnsmap for DNS collection and analysis
[colorful] Net dto mapping
从ADK的WinPE自己手动构建自己的PE
Is the brokerage account in qiniu business school safe? Is the account opening rate low
[GXYCTF2019]禁止套娃--详解
硬(磁)盘(二)
Delphi Chinese digit to Arabic digit
[Error] invalid use of incomplete type 使用了未定义的类型
Cve-2021-24078 vulnerability analysis
ucore lab3
Successfully installed opencv under delphixe