当前位置:网站首页>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);
}
}
边栏推荐
- [GXYCTF2019]禁止套娃--详解
- 2022 constructeur - direction de l'équipement - Fondation générale (constructeur) Questions d'examen du certificat d'exploitation et examen de simulation
- [LeetCode]21. Merge two ordered linked lists twenty-nine
- The difference between philosophy and Literature
- The whole process from entering URL to displaying page (interview)
- What are the conditions of index invalidation?
- Target recognition gadget
- Pipelines in go concurrency mode
- Ad14 component pin name disappeared
- Three kinds of thinking make me reborn
猜你喜欢
Map from getting started to performance optimization
硬(磁)盘(一)
antdPro - ProTable 实现两个选择框联动效果
Stm32f4 development of DMA transmission to GPIO port
[MRCTF2020]Ez_bypass --BUUCTF
Kaust:deyao Zhu | value memory map: a graph structured world model based on off-line reinforcement learning
A simple deadlock example
[matlab] symbol calculation
[gxyctf2019] no dolls -- detailed explanation
6.824 Lab 3B: Fault-tolerant Key/Value Service
随机推荐
ucore lab1
2022施工员-设备方向-通用基础(施工员)操作证考试题及模拟考试
Matlab [path planning] - UAV drug distribution route optimization
[LeetCode]20. Valid parentheses thirty-six
Several interview questions in TCP three grips and four swings
Kaust:deyao Zhu | value memory map: a graph structured world model based on off-line reinforcement learning
Using com0com/com2tcp to realize TCP to serial port (win10)
Delphi Chinese digit to Arabic digit
Can branches sign labor contracts with employees
How to quickly query the mobile phone number home and operator
Make the tasks in the scheduled task XXL job flexible
PLC can also make small games ----- CoDeSys can write small games of guessing numbers
Daily buckle exercise - conclusion
The origin of MySQL in bedtime stories
2022施工員-設備方向-通用基礎(施工員)操作證考試題及模擬考試
Penetration test summary
Some basic design knowledge
浏览器控制台注入JS
1115. alternate printing foobar
Lambda expression