Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<Wire.h>
- const int MPU_addr=0x68;
- int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
- void setup(){
- Wire.begin();
- Wire.beginTransmission(MPU_addr);
- Wire.write(0x6B);
- Wire.write(0);
- Wire.endTransmission(true);
- Serial.begin(9600);
- }
- void loop(){
- Wire.beginTransmission(MPU_addr);
- Wire.write(0x3B);
- Wire.endTransmission(false);
- Wire.requestFrom(MPU_addr,14,true);
- GyX=Wire.read()<<8|Wire.read();
- GyY=Wire.read()<<8|Wire.read();
- GyZ=Wire.read()<<8|Wire.read();
- Serial.print(" | GyX = "); Serial.print(GyX);
- Serial.print(" | GyY = "); Serial.print(GyY);
- Serial.print(" | GyZ = "); Serial.println(GyZ);
- delay(333);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement