BASIC4MCU | 질문게시판 | 아두이노 리니어스텝모터 구동 질문있습니다
페이지 정보
작성자 캡왕짱 작성일2022-11-28 13:06 조회1,223회 댓글1건
https://www.basic4mcu.com/bbs/board.php?bo_table=gac&wr_id=21865
본문
![]() | FSL30 소형 리니어 스텝모터 엑츄에이터 (행정길이 100~300mm) : 드림텍LMS[드림텍LMS] 자동화시스템, ROBOT, 리니어스테핑모터 전문 업체 SMARTSTORE.NAVER.COM |
Arduino/Tb6560Arduino.ino at master · jumejume1/ArduinoMaker Tutor Channel. Contribute to jumejume1/Arduino development by creating an account on GitHub. GitHub |
아래의 코드로 리니어 스텝모터를 구동하였는데 x값이 대략 32400을 넘으면 범위값을 상실해서 거리 조절이 안됩니다.
총 리니어를 300mm만큼 위아래로 움직이고 싶습니다.
감사합니당..
// defines pins numbers | |
const int stepPin = 5; | |
const int dirPin = 2; | |
const int enPin = 8; | |
void setup() { | |
// Sets the two pins as Outputs | |
pinMode(stepPin,OUTPUT); | |
pinMode(dirPin,OUTPUT); | |
pinMode(enPin,OUTPUT); | |
digitalWrite(enPin,LOW); | |
} | |
void loop() { | |
digitalWrite(dirPin,HIGH); // Enables the motor to move in a particular direction | |
// Makes 200 pulses for making one full cycle rotation | |
for(int x = 0; x < 800; x++) { | |
digitalWrite(stepPin,HIGH); | |
delayMicroseconds(500); | |
digitalWrite(stepPin,LOW); | |
delayMicroseconds(500); | |
} | |
delay(1000); // One second delay | |
digitalWrite(dirPin,LOW); //Changes the rotations direction | |
// Makes 400 pulses for making two full cycle rotation | |
for(int x = 0; x < 800; x++) { | |
digitalWrite(stepPin,HIGH); | |
delayMicroseconds(500); | |
digitalWrite(stepPin,LOW); | |
delayMicroseconds(500); | |
} | |
delay(1000); | |
} |
댓글 1
조회수 1,223master님의 댓글
master 작성일
int 데이터형은 -32768~32767 범위입니다.
long 형을 사용하세요