Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed
Fork of MbedSmartRestMain by
measurement/Acceleration.h
- Committer:
- xinlei
- Date:
- 2015-05-08
- Revision:
- 101:dbcd3bc51758
- Child:
- 124:311fa85af2b3
File content as of revision 101:dbcd3bc51758:
#ifndef ACCELERATION_H
#define ACCELERATION_H
#include "mbed.h"
#include "MMA7660.h"
#include "AbstractReporter.h"
class Acceleration: public AbstractReporter
{
public:
Acceleration(): deviceReady(false), sensor(SDA, SCL) {
oldValues[0] = 0;
oldValues[1] = 0;
oldValues[2] = 0;
t_start = time(NULL);
}
virtual ~Acceleration() {}
virtual bool init() {
deviceReady = sensor.testConnection();
return deviceReady;
}
virtual const char* name() const { return "Acc"; }
virtual size_t read(char*, size_t, char*, size_t);
private:
bool deviceReady;
MMA7660 sensor;
float oldValues[3];
time_t t_start;
};
#endif /* ACCELERATION_H */

Cumulocity