0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Arduinoでサーボモータを使う

Posted at

この記事は、arduinoでサーボモータ(SG90)を使うためのものです。1個当たり200円以下で購入出来ます。電力的にはarduino1台で1個フルに使っても大丈夫なモーターです。そんなにパワーは出ません。

接続方法

赤<->5V
茶<->GND
橙<->4(Digital)
SERVO.JPG

プログラム

servo.ino
# include<Servo.h>
 
Servo servo;
 
void setup(void){  
  servo.attach(4);
}
 
void loop(void){
  servo.write(0);
  delay(500);
  servo.write(30);
  delay(500);
  servo.write(60);
  delay(500);
  servo.write(100);
  delay(500);
}


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?