Revision f12bf4b5 examples/rawdata/rawdata.ino

View differences:

examples/rawdata/rawdata.ino
11 11
   Connect SDA to analog 4
12 12
   Connect VDD to 3.3V DC
13 13
   Connect GROUND to common ground
14
    
14

  
15 15
   History
16 16
   =======
17 17
   2015/MAR/03  - First release (KTOWN)
......
19 19

  
20 20
/* Set the delay between fresh samples */
21 21
#define BNO055_SAMPLERATE_DELAY_MS (100)
22
   
22

  
23 23
Adafruit_BNO055 bno = Adafruit_BNO055();
24 24

  
25 25
/**************************************************************************/
......
27 27
    Arduino setup function (automatically called at startup)
28 28
*/
29 29
/**************************************************************************/
30
void setup(void) 
30
void setup(void)
31 31
{
32 32
  Serial.begin(9600);
33 33
  Serial.println("Orientation Sensor Raw Data Test"); Serial.println("");
34
  
34

  
35 35
  /* Initialise the sensor */
36 36
  if(!bno.begin())
37 37
  {
......
39 39
    Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
40 40
    while(1);
41 41
  }
42
  
42

  
43 43
  delay(1000);
44
    
44

  
45 45
  /* Display the current temperature */
46 46
  int8_t temp = bno.getTemp();
47 47
  Serial.print("Current Temperature: ");
48 48
  Serial.print(temp);
49 49
  Serial.println(" C");
50 50
  Serial.println("");
51
  
51

  
52 52
  bno.setExtCrystalUse(true);
53

  
54
  Serial.println("Calibration status values: 0=uncalibrated, 3=fully calibrated");
53 55
}
54 56

  
55 57
/**************************************************************************/
......
58 60
    should go here)
59 61
*/
60 62
/**************************************************************************/
61
void loop(void) 
63
void loop(void)
62 64
{
63 65
  // Possible vector values can be:
64 66
  // - VECTOR_ACCELEROMETER - m/s^2
......
68 70
  // - VECTOR_LINEARACCEL   - m/s^2
69 71
  // - VECTOR_GRAVITY       - m/s^2
70 72
  imu::Vector<3> euler = bno.getVector(Adafruit_BNO055::VECTOR_EULER);
71
  
73

  
72 74
  /* Display the floating point data */
73 75
  Serial.print("X: ");
74 76
  Serial.print(euler.x());
......
76 78
  Serial.print(euler.y());
77 79
  Serial.print(" Z: ");
78 80
  Serial.print(euler.z());
79
  Serial.println("");
81
  Serial.print("\t\t");
80 82

  
81 83
  /*
82 84
  // Quaternion data
......
89 91
  Serial.print(quat.x(), 4);
90 92
  Serial.print(" qZ: ");
91 93
  Serial.print(quat.z(), 4);
92
  Serial.println("");
94
  Serial.print("\t\t");
93 95
  */
94
  
96

  
97
  /* Display calibration status for each sensor. */
98
  uint8_t system, gyro, accel, mag = 0;
99
  bno.getCalibration(&system, &gyro, &accel, &mag);
100
  Serial.print("CALIBRATION: Sys=");
101
  Serial.print(system, DEC);
102
  Serial.print(" Gyro=");
103
  Serial.print(gyro, DEC);
104
  Serial.print(" Accel=");
105
  Serial.print(accel, DEC);
106
  Serial.print(" Mag=");
107
  Serial.println(mag, DEC);
108

  
95 109
  delay(BNO055_SAMPLERATE_DELAY_MS);
96
}
110
}

Also available in: Unified diff