Board logo

標題: 步進馬達 [打印本頁]

作者: tonyh    時間: 2021-3-28 14:06     標題: 步進馬達

步進馬達種類非常多,我們使用的是 28BYJ-48 5V 步進馬達與 ULN2003 步進馬達驅動模組的搭配。其工作原理如下圖,可精準控制轉動的角度。

[attach]11611[/attach]

[attach]11612[/attach]
  1. #include <Stepper.h>
  2. const int stepsPerRevolution = 2048;
  3. Stepper myStepper(stepsPerRevolution, 8, 10, 9, 11);
  4. void setup() {
  5.   //15-1
  6.   myStepper.setSpeed(15);
  7. }

  8. void loop() {
  9.   myStepper.step(1200);
  10.   delay(3000);
  11.   myStepper.step(-1200);
  12.   delay(3000);
  13. }
複製代碼





歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/) Powered by Discuz! 7.2