Stepper(steps, pin1, pin2), Stepper(steps, pin1, pin2, pin3, pin4)
描述
呼叫該函式創建 Stepper
物件,每一個 Stepper
物件對應一個 86Duino 連接的步進馬達。呼叫這個函式在草稿碼的上面,也就是在 setup()
和 loop()
的上面。該函式的參數數量取決於 86Duino 與步進馬達之間連接線的數量。
參數
steps
:步進馬達轉一圈所需要的步數,如果步進馬達規格書上寫著每一步轉動的角度,把 360 除以該步進角就會得到步進馬達轉動一圈所需步數(例:假設步進角為 3.6,360/3.6 = 100,轉動一圈需要 100 步)。
pin1
, pin2
:連接至步進馬達的兩個腳位
pin3
, pin4
:連接至步進馬達的兩個腳位,如果只有用兩條線連接則不需要提供這兩個參數,如果是用四條線連接就要提供
回傳
新創建的 Stepper
物件
範例
Stepper myStepper = Stepper(100, 5, 6);
See also
The text of the 86Duino reference is a modification of the Arduino reference, and is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.