Skip to content

Instantly share code, notes, and snippets.

@kelliott121
Last active May 29, 2016 23:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kelliott121/c950cc3d4d5ebee1159d4add34f74239 to your computer and use it in GitHub Desktop.
Save kelliott121/c950cc3d4d5ebee1159d4add34f74239 to your computer and use it in GitHub Desktop.
#ifndef HCSR04_H
#define HCSR04_H
#include "Arduino.h"
#define CM 1
#define INCH 0
class HCSR04
{
public:
HCSR04(uint8_t triggerPin, uint8_t echoPin);
HCSR04(uint8_t triggerPin, uint8_t echoPin, uint32_t timeout);
uint32_t timing();
uint16_t getDistance(uint8_t units, uint8_t samples);
private:
uint8_t _triggerPin;
uint8_t _echoPin;
uint32_t _timeout;
};
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment