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.