Skip to content

Commit 52b718a

Browse files
committed
0.5.1 GY521
1 parent 221507b commit 52b718a

File tree

13 files changed

+31
-19
lines changed

13 files changed

+31
-19
lines changed

libraries/GY521/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

88

9+
## [0.5.1] - 2023-12-11
10+
- redo initialization order.
11+
12+
913
## [0.5.0] - 2023-12-05
1014
- refactor API, begin()
1115
- update readme.md

libraries/GY521/GY521.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//
22
// FILE: GY521.cpp
33
// AUTHOR: Rob Tillaart
4-
// VERSION: 0.5.0
4+
// VERSION: 0.5.1
55
// PURPOSE: Arduino library for I2C GY521 accelerometer-gyroscope sensor
66
// URL: https://github.com/RobTillaart/GY521
77

@@ -25,7 +25,13 @@ GY521::GY521(uint8_t address, TwoWire *wire)
2525
{
2626
_address = address;
2727
_wire = wire;
28-
reset();
28+
29+
_ax = _ay = _az = 0;
30+
_aax = _aay = _aaz = 0;
31+
_gx = _gy = _gz = 0;
32+
_pitch = 0;
33+
_roll = 0;
34+
_yaw = 0;
2935
}
3036

3137

@@ -35,6 +41,7 @@ bool GY521::begin()
3541
{
3642
return wakeup();
3743
}
44+
reset();
3845
return false;
3946
}
4047

libraries/GY521/GY521.h

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// FILE: GY521.h
44
// AUTHOR: Rob Tillaart
5-
// VERSION: 0.5.0
5+
// VERSION: 0.5.1
66
// PURPOSE: Arduino library for I2C GY521 accelerometer-gyroscope sensor
77
// URL: https://github.com/RobTillaart/GY521
88

@@ -11,7 +11,7 @@
1111
#include "Wire.h"
1212

1313

14-
#define GY521_LIB_VERSION (F("0.5.0"))
14+
#define GY521_LIB_VERSION (F("0.5.1"))
1515

1616

1717
// THROTTLE TIMING
@@ -39,10 +39,6 @@ class GY521
3939
public:
4040
GY521(uint8_t address = 0x69, TwoWire *wire = &Wire); // 0x68 or 0x69
4141

42-
43-
#if defined (ESP8266) || defined(ESP32)
44-
bool begin(uint8_t sda, uint8_t scl);
45-
#endif
4642
bool begin();
4743
bool isConnected();
4844
void reset();
@@ -74,12 +70,12 @@ class GY521
7470
int16_t read();
7571
// optimized partial reading
7672
// read accelerometer only
77-
int16_t readAccel();
73+
int16_t readAccel();
7874
// read gyroscope only can be done too
7975
// however for pitch roll yaw you need all.
80-
int16_t readGyro();
76+
int16_t readGyro();
8177
// read temperature only, does not affect throttle.
82-
int16_t readTemperature();
78+
int16_t readTemperature();
8379

8480

8581
// CALL AFTER READ

libraries/GY521/examples/GY521_angle/GY521_angle.ino

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// FILE: GY521_angle.ino
33
// AUTHOR: Rob Tillaart
44
// PURPOSE: read angleX, angleY, angleZ
5+
// URL: https://github.com/RobTillaart/GY521
56

67

78
#include "GY521.h"
@@ -56,8 +57,8 @@ void loop()
5657
// Serial.println("\nCNT\tX\tY\tZ");
5758
}
5859

59-
// Serial.print(counter);
60-
// Serial.print('\t');
60+
// Serial.print(counter);
61+
// Serial.print('\t');
6162
Serial.print(x, 1);
6263
Serial.print('\t');
6364
Serial.print(y, 1);

libraries/GY521/examples/GY521_performance/GY521_performance.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// FILE: GY521_performance.ino
33
// AUTHOR: Rob Tillaart
44
// PURPOSE: minimal demo
5-
5+
// URL: https://github.com/RobTillaart/GY521
66

77
#include "GY521.h"
88

libraries/GY521/examples/GY521_pitch_roll_yaw/GY521_pitch_roll_yaw.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// FILE: GY521_pitch_roll_yaw.ino
33
// AUTHOR: Rob Tillaart
44
// PURPOSE: demo pitch roll yaw
5+
// URL: https://github.com/RobTillaart/GY521
56

67

78
#include "GY521.h"

libraries/GY521/examples/GY521_readCalibration_1/GY521_readCalibration_1.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// FILE: GY521_readCalibration_1.ino
33
// AUTHOR: Rob Tillaart
44
// PURPOSE: read the calibration values / errors for a flat sensor.
5+
// URL: https://github.com/RobTillaart/GY521
56

67

78
#include "GY521.h"
@@ -29,7 +30,7 @@ void setup()
2930
{
3031
Serial.println("Could not connect to GY521");
3132
}
32-
// adjust when needed.
33+
// adjust when needed.
3334
sensor.setAccelSensitivity(0); // 2g
3435
sensor.setGyroSensitivity(0); // 250 degrees/s
3536
sensor.setThrottle(false);

libraries/GY521/examples/GY521_readCalibration_2/GY521_readCalibration_2.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// FILE: readCalibration_2.ino
33
// AUTHOR: Rob Tillaart
44
// PURPOSE: read the calibration values / errors for a flat sensor.
5-
5+
// URL: https://github.com/RobTillaart/GY521
66

77
#include "GY521.h"
88

libraries/GY521/examples/GY521_test_1/GY521_test_1.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// FILE: GY521_test_1.ino
33
// AUTHOR: Rob Tillaart
44
// PURPOSE: minimal demo to test working of the sensor.
5-
5+
// URL: https://github.com/RobTillaart/GY521
66

77
#include "GY521.h"
88

libraries/GY521/examples/GY521_test_2/GY521_test_2.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// FILE: GY521_test_2.ino
33
// AUTHOR: Rob Tillaart
44
// PURPOSE: test set/get functions
5+
// URL: https://github.com/RobTillaart/GY521
56

67

78
#include "GY521.h"

0 commit comments

Comments
 (0)