-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add readAccell(), readGyro and readTemperature() (#35)
* add readAccel() readGyro() readTemperature() * update readme.md * rename examples
- Loading branch information
1 parent
d85def3
commit 39b52fb
Showing
13 changed files
with
423 additions
and
35 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// | ||
// FILE: GY521_angle.ino | ||
// AUTHOR: Rob Tillaart | ||
// PURPOSE: demo pitch roll yaw | ||
// DATE: 2022-06-06 | ||
|
||
|
||
#include "GY521.h" | ||
|
||
GY521 sensor(0x68); | ||
|
||
uint32_t counter = 0; | ||
|
||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
Serial.println(); | ||
Serial.println(__FILE__); | ||
Serial.print("GY521_LIB_VERSION: "); | ||
Serial.println(GY521_LIB_VERSION); | ||
|
||
Wire.begin(); | ||
|
||
delay(100); | ||
while (sensor.wakeup() == false) | ||
{ | ||
Serial.print(millis()); | ||
Serial.println("\tCould not connect to GY521"); | ||
delay(1000); | ||
} | ||
sensor.setAccelSensitivity(2); // 8g | ||
sensor.setGyroSensitivity(1); // 500 degrees/s | ||
|
||
sensor.setThrottle(); | ||
Serial.println("start..."); | ||
|
||
// set calibration values from calibration sketch. | ||
sensor.axe = 0.574; | ||
sensor.aye = -0.002; | ||
sensor.aze = -1.043; | ||
sensor.gxe = 10.702; | ||
sensor.gye = -6.436; | ||
sensor.gze = -0.676; | ||
} | ||
|
||
|
||
void loop() | ||
{ | ||
sensor.read(); | ||
float x = sensor.getAngleX(); | ||
float y = sensor.getAngleY(); | ||
float z = sensor.getAngleZ(); | ||
|
||
if (counter % 10 == 0) | ||
{ | ||
// Serial.println("\nCNT\tX\tY\tZ"); | ||
} | ||
|
||
//Serial.print(counter); | ||
//Serial.print('\t'); | ||
Serial.print(x, 1); | ||
Serial.print('\t'); | ||
Serial.print(y, 1); | ||
Serial.print('\t'); | ||
Serial.print(z, 1); | ||
Serial.println(); | ||
|
||
counter++; | ||
} | ||
|
||
|
||
// -- END OF FILE -- | ||
|
This file contains 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
Oops, something went wrong.