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-29
 - Revision:
 - 124:311fa85af2b3
 - Parent:
 - 101:dbcd3bc51758
 - Child:
 - 137:a52821cdb108
 
File content as of revision 124:311fa85af2b3:
#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), timer() {
                oldValues[0] = 0;
                oldValues[1] = 0;
                oldValues[2] = 0;
                timer.start();
        }
        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];
        Timer timer;
};
#endif /* ACCELERATION_H */
            
    
            Cumulocity