描述
技術規格
電壓:4.8v~6v
4.8v時
速度:0.12 秒/60°
扭力:1.2 公斤/公分
重量:9 g
尺寸(單位mm)
尺寸:23×12.2x29mm (長 x寬x高)
接線方式
伺服馬達 的 訊號線(黃線) 接至 Arduino D9腳
伺服馬達 的 VCC(紅線) 接至 Arduino 5V腳
伺服馬達 的 GND(棕線) 接至 Arduino GND腳
注意燒錄時將伺服馬達接線移除,否則可能會造成燒錄失敗
程式範例
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
/* Sweep by BARRAGAN <http://barraganstudio.com> This example code is in the public domain. modified 8 Nov 2013 by Scott Fitzgerald http://www.arduino.cc/en/Tutorial/Sweep */ #include <Servo.h> Servo myservo; // create servo object to control a servo // twelve servo objects can be created on most boards int pos = 0; // variable to store the servo position void setup() { myservo.attach(9); // attaches the servo on pin 9 to the servo object } void loop() { for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees // in steps of 1 degree myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } } |
參考來源
Arduino內建Library