LMS行政E化暨班級社群教職員工數位歷程檔線上手冊Login
Position: 王文良 > 專題製作
Arduino + CNC Stepper Motor
by 王文良 2020-05-06 08:36:30, Reply(2), Views(125)
Motor Motor 介紹
https://dronebotworkshop.com/big-stepper-motors/





Arduino 程式: 
const int dirPin  = 3;
const int stepPin = 4; 
const int enPin   = 5;

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 < 1600; 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 < 1600; x++) {
    digitalWrite(stepPin,HIGH);
    delayMicroseconds(1000);
    digitalWrite(stepPin,LOW);
    delayMicroseconds(1000);
  }

  delay(1000);
}
Reply(2)
主任這是什麼
看起來很好玩
這是二軸龍門機器人,實體成品在資訊科材料室組裝中
Reply