CAFE

한국직업능력교육원

[스크랩] [Arduino 실습 36] 스탭모터 돌리기-1(Kit 제공용, 기본 라이브러리 사용)

작성자송명규|작성시간26.06.22|조회수7 목록 댓글 0

기본 라이브러리 사용한 겁니다.

 

 



#include <Stepper.h>

 

#include <value.h>

#include <My_Arduino_GPIO_Lib_V1_8.h>

 

#include "st_motor.h"



const int step_reg = 2048; // 분해능

Stepper st_motor(step_reg, 8, 10, 9, 11); // a, b, /a, /b




void setup() {

  // put your setup code here, to run once:

  //st_init();

  st_motor.setSpeed(18); //Speed

}

 

void loop() {

  // put your main code here, to run repeatedly:

  // 실습2 = 가감속 제어하기 = 별도 라이브러리 설치해야



 // 실습 1 = 기본돌리기 = 기존 라이브러리 사용  

  // cw

  st_motor.step(step_reg);

  delay(1000);

 

  // CCW

  st_motor.step(-step_reg);

  delay(1000);

}









다음검색
현재 게시글 추가 기능 열기

댓글

댓글 리스트
맨위로

카페 검색

카페 검색어 입력폼