README.md: update MMA7660 snippet to reflect current reality

Signed-off-by: Jon Trulson <jtrulson@ics.com>
This commit is contained in:
Jon Trulson 2017-04-05 12:37:11 -06:00
parent c57a0d2c30
commit e6ed49427a

View File

@ -37,29 +37,21 @@ A sensor/actuator is expected to work as such (here is the MMA7660 accelerometer
accel->setModeStandby(); accel->setModeStandby();
// enable 64 samples per second // enable 64 samples per second
accel->setSampleRate(upm::MMA7660::AUTOSLEEP_64); accel->setSampleRate(MMA7660_AUTOSLEEP_64);
// place device into active mode // place device into active mode
accel->setModeActive(); accel->setModeActive();
while (shouldRun) while (shouldRun)
{ {
int x, y, z;
accel->getRawValues(&x, &y, &z);
cout << "Raw values: x = " << x
<< " y = " << y
<< " z = " << z
<< endl;
float ax, ay, az; float ax, ay, az;
accel->getAcceleration(&ax, &ay, &az); accel->getAcceleration(&ax, &ay, &az);
cout << "Acceleration: x = " << ax cout << "Acceleration: x = " << ax
<< "g y = " << ay << "g y = " << ay
<< "g z = " << az << "g z = " << az
<< "g" << endl; << "g" << endl;
usleep(500000); usleep(500000);
} }
``` ```