Created
March 29, 2016 11:12
-
-
Save anbara/b58c8a8dd6ec8f9d7f29 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//JY901のライブラリを使わないでキャリブレーションするプログラム | |
#include <Wire.h> | |
void setup() | |
{ | |
Wire.begin(); | |
Serial.begin(9600); | |
//Z軸調整モード | |
Wire.beginTransmission(0x50); //J901との通信開始 | |
Wire.write(0x01); //キャリブレーションモード選択 | |
Wire.write(0x03); //下位ビット | |
Wire.write(0); //上位ビット | |
Wire.endTransmission(); //通信終了 | |
delay(1000); //待機時間)(任意) | |
//磁気センサキャリブレーションモード | |
Wire.beginTransmission(0x50); //J901との通信開始 | |
Wire.write(0x01); //キャリブレーションモード選択 | |
Wire.write(0x02); //下位ビット | |
Wire.write(0); //上位ビット | |
Wire.endTransmission(); //通信終了 | |
delay(5000); //キャリブレーション時間(任意) | |
//キャリブレーションモード終了 | |
Wire.beginTransmission(0x50); //J901との通信開始 | |
Wire.write(0x01); //キャリブレーション | |
Wire.write(0); //下位ビット | |
Wire.write(0); //上位ビット | |
Wire.endTransmission(); //通信終了 | |
} | |
void loop() | |
{ | |
//無し | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment