Revision 2fa9c672 examples/bunny/bunny.ino

View differences:

examples/bunny/bunny.ino
5 5

  
6 6
/* This driver uses the Adafruit unified sensor library (Adafruit_Sensor),
7 7
   which provides a common 'type' for sensor data and some helper functions.
8
   
8

  
9 9
   To use this driver you will also need to download the Adafruit_Sensor
10 10
   library and include it in your libraries folder.
11 11

  
......
14 14
   sensor in any data logs, etc.  To assign a unique ID, simply
15 15
   provide an appropriate value in the constructor below (12345
16 16
   is used by default in this example).
17
   
17

  
18 18
   Connections
19 19
   ===========
20 20
   Connect SCL to analog 5
21 21
   Connect SDA to analog 4
22 22
   Connect VDD to 3.3-5V DC
23 23
   Connect GROUND to common ground
24
    
24

  
25 25
   History
26 26
   =======
27 27
   2015/MAR/03  - First release (KTOWN)
......
48 48
  Serial.print  ("Unique ID:    "); Serial.println(sensor.sensor_id);
49 49
  Serial.print  ("Max Value:    "); Serial.print(sensor.max_value); Serial.println(" xxx");
50 50
  Serial.print  ("Min Value:    "); Serial.print(sensor.min_value); Serial.println(" xxx");
51
  Serial.print  ("Resolution:   "); Serial.print(sensor.resolution); Serial.println(" xxx");  
51
  Serial.print  ("Resolution:   "); Serial.print(sensor.resolution); Serial.println(" xxx");
52 52
  Serial.println("------------------------------------");
53 53
  Serial.println("");
54 54
  delay(500);
......
59 59
    Arduino setup function (automatically called at startup)
60 60
*/
61 61
/**************************************************************************/
62
void setup(void) 
62
void setup(void)
63 63
{
64 64
  Serial.begin(115200);
65 65
  Serial.println("Orientation Sensor Test"); Serial.println("");
66
  
66

  
67 67
  /* Initialise the sensor */
68 68
  if(!bno.begin())
69 69
  {
......
71 71
    Serial.print("Ooops, no BNO055 detected ... Check your wiring or I2C ADDR!");
72 72
    while(1);
73 73
  }
74
  
74

  
75 75
  delay(1000);
76
    
76

  
77 77
  /* Display some basic information on this sensor */
78 78
  displaySensorDetails();
79 79
}
......
84 84
    should go here)
85 85
*/
86 86
/**************************************************************************/
87
void loop(void) 
87
void loop(void)
88 88
{
89
  /* Get a new sensor event */ 
90
  sensors_event_t event; 
89
  /* Get a new sensor event */
90
  sensors_event_t event;
91 91
  bno.getEvent(&event);
92
  
92

  
93 93
  /* Board layout:
94 94
         +----------+
95 95
         |         *| RST   PITCH  ROLL  HEADING
96 96
     ADR |*        *| SCL
97 97
     INT |*        *| SDA     ^            /->
98
     PS1 |*        *| GND     |            |   
98
     PS1 |*        *| GND     |            |
99 99
     PS0 |*        *| 3VO     Y    Z-->    \-X
100
         |         *| VIN 
100
         |         *| VIN
101 101
         +----------+
102 102
  */
103 103

  
......
110 110
  Serial.print((float)event.orientation.z);
111 111
  Serial.println(F(""));
112 112

  
113
  /* Also send calibration data for each sensor. */
114
  uint8_t sys, gyro, accel, mag = 0;
115
  bno.getCalibration(&sys, &gyro, &accel, &mag);
116
  Serial.print(F("Calibration: "));
117
  Serial.print(sys, DEC);
118
  Serial.print(F(" "));
119
  Serial.print(gyro, DEC);
120
  Serial.print(F(" "));
121
  Serial.print(accel, DEC);
122
  Serial.print(F(" "));
123
  Serial.println(mag, DEC);
124

  
113 125
  delay(BNO055_SAMPLERATE_DELAY_MS);
114
}
126
}

Also available in: Unified diff