AIServoPort 建構子
描述
初始化 AIServoPort 類別。
語法
AIServoPort(Vendor, Servo) bus
參數
Vendor
:此 bus 所欲掛載伺服機之供應商。例如:ROBOTIS。
Servo
:此 bus 所欲掛載伺服機之型號。例如:AX12、RX28、MX28、XL320。
範例
#include <AIServo86.h> AIServoPort(ROBOTIS, AX12) bus; // 初始化 bus 來控制 ROBOTIS AX-12 伺服機 AIServo myservo; // 初始化 myservo void setup() { bus.begin(Serial1, 1000000); // 設定 bus 使用的序列埠為 Serial1,baud rate 為 1000000 myservo.attach(bus, 9); // 將 myservo 掛載至 bus,且 myservo 的 ID 為 9 myservo.write(150); // 啟動伺服機並轉到 150 度 } void loop() {}
See also
- begin()
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.