// Sys Lib
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
// Arduino API
#include <Stepper.h>
// My Lib
#include <value.h>
#include <My_Arduino_GPIO_Lib_V1_8.h>
#include "stm.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:
pinMode(ma, OUTPUT);
pinMode(mb, OUTPUT);
pinMode(ma_, OUTPUT);
pinMode(mb_, OUTPUT);
st_motor.setSpeed(18); //Speed
}
void loop() {
// put your main code here, to run repeatedly:
// 실습 1 = 기본돌리기 = 기존 라이브러리 사용
// cw
st_motor.step(step_reg);
delay(1000);
// CCW
st_motor.step(-step_reg);
delay(1000);
}
//===========================================
#ifndef __STM__
#define __STM__
enum{
ma = 8, //a
mb, //9 b
ma_, //10 a_
mb_ //11 b_
}mt;
#define CW 1
#define CCw 2
#endif