mirror of
https://github.com/eclipse/upm.git
synced 2025-07-03 02:11:15 +03:00
bma250e,bmc150,bmg160,bmi055,bmm150,bmx055: C++ examples: use instance rather than allocation
Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
@ -44,7 +44,7 @@ int main(int argc, char **argv)
|
||||
//! [Interesting]
|
||||
|
||||
// Instantiate an BMM150 using default I2C parameters
|
||||
upm::BMM150 *sensor = new upm::BMM150();
|
||||
upm::BMM150 sensor;
|
||||
|
||||
// For SPI, bus 0, you would pass -1 as the address, and a valid pin
|
||||
// for CS: BMM150(0, -1, 10);
|
||||
@ -54,9 +54,9 @@ int main(int argc, char **argv)
|
||||
{
|
||||
float x, y, z;
|
||||
|
||||
sensor->update();
|
||||
sensor.update();
|
||||
|
||||
sensor->getMagnetometer(&x, &y, &z);
|
||||
sensor.getMagnetometer(&x, &y, &z);
|
||||
cout << "Magnetometer x: " << x
|
||||
<< " y: " << y
|
||||
<< " z: " << z
|
||||
@ -72,7 +72,5 @@ int main(int argc, char **argv)
|
||||
|
||||
cout << "Exiting..." << endl;
|
||||
|
||||
delete sensor;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user