Code for sensor nodes connected by radio receiver with gateway

Dependencies:   mbed WakeUp coapRadioClient DHT11

distanceMeter.h

Committer:
Ka_myk
Date:
22 months ago
Revision:
7:2393eb882f82
Parent:
6:5102672e8ff4

File content as of revision 7:2393eb882f82:

#ifndef MBEDDED_DISTANCEMETER_H
#define MBEDDED_DISTANCEMETER_H

#include "sensor.h"

class DistanceMeter : public Sensor {
private:
    InterruptIn echo;
    DigitalOut trigger;

    Timer timer;
    int timeUs;
    bool timeReady;

    void echoUp();
    void echoDown();

public:
    int read();
    
    int getSensorId();

    void initialize();
    
    DistanceMeter(PinName echoPin, PinName triggerPin);
};

#endif //MBEDDED_DISTANCEMETER_H