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で2軸ジャイロセンサを使う

Posted at

この記事は、arduinoで2軸ジャイロセンサ()を使うためのものです。1個当たり400円以下で購入出来ます。小さいのが特徴です。
http://akizukidenshi.com/catalog/g/gK-04912/
※ジャイロセンサとは角速度を求めるセンサです。重力に方向に対して絶対的な角度は出せません。単位時間あたりの角度の変化を調べられます。

接続方法

1<->A0
2<->A1
7<->GND
8<->5V
vib.JPG

プログラム

説明書によると1.35Vが基準値なので、5Vで動くArduinoの値に変換します。
1.35/5.0*1024 = 276.48
実際には少しずれるようです。

シリアルプロッタで確認するプログラム例です。

jyro2axis.ino
float x,y;

//1.35/5.0*1024

void setup() {
  Serial.begin(9600);
}

void loop(){
  x += analogRead(0)-296.46;
  y += analogRead(1)-292.9;
  Serial.print(x);
  Serial.print(",");
  Serial.println(y);
  delay(10) ;
}


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?