Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
0
Help us understand the problem. What is going on with this article?
@hextomino

Arduinoで2軸ジャイロセンサを使う

More than 1 year has passed since last update.

この記事は、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
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
0
Help us understand the problem. What is going on with this article?