File tree Expand file tree Collapse file tree 7 files changed +123
-89
lines changed Expand file tree Collapse file tree 7 files changed +123
-89
lines changed Original file line number Diff line number Diff line change @@ -161,6 +161,7 @@ float* GY_85::readGyro()
161
161
162
162
void GY_85::init ()
163
163
{
164
+ Wire.begin ();
164
165
SetAccelerometer ();
165
166
SetCompass ();
166
167
SetGyro ();
Original file line number Diff line number Diff line change 1
- #include " Arduino.h"
2
- #include < Wire.h>
3
-
4
1
#ifndef GY_85_h
5
2
#define GY_85_h
6
3
4
+ #if ARDUINO >= 100
5
+ #include " Arduino.h"
6
+ #else
7
+ #include " WProgram.h"
8
+ #endif
9
+
10
+ #include < Wire.h>
11
+
7
12
// ----------addresses----------//
8
13
#define ADXL345 (0x53 ) // Device address as specified in data sheet //ADXL345 accelerometer
9
14
#define DATAX0 (0x32 ) // X-Axis Data 0
16
21
#define ITG3200 (0x68 ) // compass
17
22
18
23
19
- class GY_85
20
- {
24
+ class GY_85 {
21
25
22
26
private:
23
27
void GyroCalibrate ();
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ GY-85 Arduino Library
2
+ =====================
3
+ A basic GY-85 raw data getter for arduino.
4
+
5
+ Wiring for arduino UNO:
6
+
7
+ GY-85 -> Arduino
8
+ --------------------
9
+ VCC_IN -> 5V
10
+ GND -> GND
11
+ SCL -> A5
12
+ SDA -> A4
13
+
14
+ For other arduino boards you have to check the I2C pins.
15
+
16
+ Installation
17
+ --------------------
18
+ Download library and move it to your Arduino/libraries folder
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ #include " GY_85.h"
2
+
3
+ // Create module object
4
+ GY_85 GY85;
5
+
6
+ void setup () {
7
+ // Initialize the serial communication:
8
+ Serial.begin (9600 );
9
+
10
+ // Initialize module
11
+ GY85.init ();
12
+ }
13
+
14
+ void loop () {
15
+ // Read data from sensors
16
+ int * accelerometerReadings = GY85.readFromAccelerometer ();
17
+ int ax = GY85.accelerometer_x (accelerometerReadings);
18
+ int ay = GY85.accelerometer_y (accelerometerReadings);
19
+ int az = GY85.accelerometer_z (accelerometerReadings);
20
+
21
+ int * compassReadings = GY85.readFromCompass ();
22
+ int cx = GY85.compass_x (compassReadings);
23
+ int cy = GY85.compass_y (compassReadings);
24
+ int cz = GY85.compass_z (compassReadings);
25
+
26
+ float * gyroReadings = GY85.readGyro ();
27
+ float gx = GY85.gyro_x (gyroReadings);
28
+ float gy = GY85.gyro_y (gyroReadings);
29
+ float gz = GY85.gyro_z (gyroReadings);
30
+ float gt = GY85.temp (gyroReadings);
31
+
32
+ // Log it to serial port
33
+ Serial.print (" accelerometer" );
34
+ Serial.print (" x:" );
35
+ Serial.print (ax);
36
+ Serial.print (" y:" );
37
+ Serial.print (ay);
38
+ Serial.print (" z:" );
39
+ Serial.print (az);
40
+
41
+ Serial.print (" \t compass" );
42
+ Serial.print (" x:" );
43
+ Serial.print (cx);
44
+ Serial.print (" y:" );
45
+ Serial.print (cy);
46
+ Serial.print (" z:" );
47
+ Serial.print (cz);
48
+
49
+ Serial.print (" \t gyro" );
50
+ Serial.print (" x:" );
51
+ Serial.print (gx);
52
+ Serial.print (" y:" );
53
+ Serial.print (gy);
54
+ Serial.print (" z:" );
55
+ Serial.print (gz);
56
+ Serial.print (" \t gyro temp:" );
57
+ Serial.println (gt);
58
+
59
+ // Make delay between readings
60
+ delay (100 );
61
+ }
Original file line number Diff line number Diff line change
1
+ #######################################
2
+ # Syntax Coloring Map For GY_85
3
+ #######################################
4
+
5
+ #######################################
6
+ # Datatypes (KEYWORD1)
7
+ #######################################
8
+
9
+ GY_85 KEYWORD1
10
+
11
+ #######################################
12
+ # Methods and Functions (KEYWORD2)
13
+ #######################################
14
+
15
+ init KEYWORD2
16
+ readFromAccelerometer KEYWORD2
17
+ readFromCompass KEYWORD2
18
+ readGyro KEYWORD2
19
+ accelerometer_x KEYWORD2
20
+ accelerometer_y KEYWORD2
21
+ accelerometer_z KEYWORD2
22
+ compass_x KEYWORD2
23
+ compass_y KEYWORD2
24
+ compass_z KEYWORD2
25
+ gyro_x KEYWORD2
26
+ gyro_y KEYWORD2
27
+ gyro_z KEYWORD2
28
+ temp KEYWORD2
29
+
30
+ #######################################
31
+ # Constants (LITERAL1)
32
+ #######################################
33
+
34
+ #sample LITERAL1
You can’t perform that action at this time.
0 commit comments