MakeBlock Drive Updated Updated library for MakeBlock Ranger

Loading...
Searching...
No Matches
MeUltrasonicSensor.h
Go to the documentation of this file.
1
53#ifndef MeUltrasonicSensor_H
54#define MeUltrasonicSensor_H
55
56#include <stdint.h>
57#include <stdbool.h>
58#include <Arduino.h>
59#include "MeConfig.h"
60
61#ifdef ME_PORT_DEFINED
62#include "MePort.h"
63#endif // ME_PORT_DEFINED
64
70#ifndef ME_PORT_DEFINED
71 class MeUltrasonicSensor
72#else // !ME_PORT_DEFINED
73class MeUltrasonicSensor : public MePort
74#endif // !ME_PORT_DEFINED
75{
76 public:
77#ifdef ME_PORT_DEFINED
84 MeUltrasonicSensor(void);
85
91 MeUltrasonicSensor(uint8_t port);
92#else // ME_PORT_DEFINED
99 MeUltrasonicSensor(uint8_t port);
100#endif // ME_PORT_DEFINED
101
116 void setpin(uint8_t SignalPin);
117
132 double distanceCm(uint16_t = 400);
133
148 double distanceInch(uint16_t = 180);
149
165 long measure(unsigned long = 30000);
166 private:
167 volatile uint8_t _SignalPin;
168 volatile bool _measureFlag;
169 volatile long _lastEnterTime;
170 volatile float _measureValue;
171};
172
173#endif
174
MeConfig.h
Configuration file of library.
MePort.h
Header for MePort.cpp module.
MePort
Port Mapping for RJ25.
Definition MePort.h:128
MeUltrasonicSensor
Driver for Me ultrasonic sensor device.
Definition MeUltrasonicSensor.h:75
MeUltrasonicSensor::distanceInch
double distanceInch(uint16_t=180)
Definition MeUltrasonicSensor.cpp:151
MeUltrasonicSensor::MeUltrasonicSensor
MeUltrasonicSensor(void)
Definition MeUltrasonicSensor.cpp:54
MeUltrasonicSensor::distanceCm
double distanceCm(uint16_t=400)
Definition MeUltrasonicSensor.cpp:123
MeUltrasonicSensor::measure
long measure(unsigned long=30000)
Definition MeUltrasonicSensor.cpp:180
MeUltrasonicSensor::setpin
void setpin(uint8_t SignalPin)
Definition MeUltrasonicSensor.cpp:98