Robotec 1.0.0
Ultrasonic.h
1/* -- Ultrasonic (Sensor de distancia por ultrasonido) --
2 *
3 * Library for Ultrasonic Ranging Module in a minimalist way
4 * created 3 Apr 2014 by Erick Simões (github: @ErickSimoes | twitter: @AloErickSimoes)
5 * Released into the MIT License.
6 */
7
8#ifndef Ultrasonic_h
9#define Ultrasonic_h
10
11#include "Arduino.h"
12
13/*** Constantes Globales Ultrasonic ***/
14static const uint8_t CM = 28;
15static const uint8_t INC = 71;
16
18 public:
19 Ultrasonic(uint8_t sigPin) : Ultrasonic(sigPin, sigPin) {};
20 Ultrasonic(uint8_t trigPin, uint8_t echoPin, unsigned long timeOut = 20000UL);
21 unsigned int read(uint8_t und = CM);
22 void setTimeout(unsigned long timeOut) {timeout = timeOut;}
23
24 private:
25 uint8_t trig;
26 uint8_t echo;
27 boolean threePins = false;
28 unsigned long previousMicros;
29 unsigned long timeout;
30 unsigned int timing();
31};
32
33#endif
Definition: Ultrasonic.h:17
unsigned int read(uint8_t und=CM)
Si la unidad de medida no es pasada como un parametro, por defecto, retornará la distancia en centime...
Definition: Ultrasonic.cpp:54