#include "Motion.h"
const int en = 8;
const int device_dir = 9;
const int device_step = 10;
int step = 2500;
int dir[5] = {HIGH, LOW, HIGH, LOW, HIGH};
HardwareSerial* selectedSerial = &Serial;
void setup() {
// 初始化串口和引腳模式
Serial.begin(115200);
pinMode(en, OUTPUT);
pinMode(device_dir, OUTPUT);
pinMode(device_step, OUTPUT);
digitalWrite(en, LOW);
Serial.println("Start: ");
}
void loop() {
// 重複運行電機動作五次
for (int i = 0; i < sizeof(dir) / sizeof(dir[0]); i++)
motor_Motion(selectedSerial, device_dir, device_step, dir[i], step);
selectedSerial->println("OK!");
}