Commits

Jody McAdams  committed b3d7910

Outputs temperature readings. Disabled filtering since it angers people.

  • Participants
  • Parent commits ed8b507

Comments (0)

Files changed (1)

File Sensors/Gyro/Gyro.ino

 const int sensorRotationScaleDPS = 250; //(can be 250, 500, or 2000)
 
 //Allow the gyroscope values to be filtered to reduce noise
-#define ENABLE_FILTERING true
+#define ENABLE_FILTERING false
 
 //Used for low pass filtering
 const float lowPassFilteringFactor = 0.1f;
 float xVal = 0.0f;
 float yVal = 0.0f;
 float zVal = 0.0f;
+float tVal = 0.0f;
 
 //filtered sensor readings (if filtering is turned on)
 float x = 0.0f;
 float y = 0.0f;
 float z = 0.0f;
 
+float temperature = 0.0f;
+
 //last time in ms
 float lastTimeMS;
 
     Serial.print(", ");
 
     Serial.print("Z:");
-    Serial.println(angleZ);
+    Serial.print(angleZ);
+    Serial.print(", ");
+    
+    Serial.print("Temp:");
+    Serial.print(temperature);
+    
+    Serial.println("");
   }
 }
 
 void getGyroValues(){
 
+  tVal = readRegister(L3G4200D_Address, 0x26);
+  temperature = 35.0f + ((tVal + 13200.0f)/280.0f);
+  
   byte xMSB = readRegister(L3G4200D_Address, 0x29);
   byte xLSB = readRegister(L3G4200D_Address, 0x28);
   xVal = scaleFactor * ((xMSB << 8) | xLSB);