Arduino library for the I²C Sonar Range Finder SRF08
SRF08.h
Go to the documentation of this file.
1 
14 #ifndef SRF08_h
15 #define SRF08_h
16 
17 // includes
18 #include <inttypes.h>
19 #include <Arduino.h>
20 #include <Wire.h>
21 
22 // defines
23 #define _SRF08_STD_ADDRESS 112
24 #define _SRF08_LIB_VERSION 101
25 
26 
30 class SRF08{
31 // Begin PUBLIC ------------------------------------------------------------------
32  public:
33 
34  // constructors
35  SRF08(); // Main constructor of the SRF08 class.
36  SRF08(uint8_t address); // Constructor of the SRF08 class with non standard i2c address.
37  ~SRF08(); // Main destructor of the SRF08 class.
38 
39  // init function
40  void init(); // Initialize the SRF08 Sensor.
41 
42  // functions
43  bool startRangeReading(); // Starts a new measurement with the SRF08 sensor if possible.
44  void startRangeReadingUNSAFE(); // Starts a new measurement with the SRF08 sensor if possible but without blocking features.
45  bool readRange(); // Reads the current range measurement from the SRF08 sensor if possible.
46  void readRangeUNSAFE(); // Reads the current range measurement from the SRF08 sensor if possible but without minimum processing delay.
47  bool checkIfReadyForReading(); // Checks if the SRF08 is ready to start a new range measurement.
48  int16_t getDistance(); // Get the last measured distance of the SRF08 sensor.
49  uint32_t getTimeOfLastReading(); // Get the system time at which the SRF08 sensor started the last range measurement.
50  uint16_t get_version(); // Get the version of the library.
51 
52 // End PUBLIC --------------------------------------------------------------------
53 
54 // Begin PRIVATE -----------------------------------------------------------------
55  private:
56 
57  // variables
58  uint8_t _addressSRF08;
59  int16_t _distance;
60  bool _isReadyForReading;
61  uint32_t _timeOfLastReading;
62  uint16_t _prosessDelay;
63 
64 // End PRIVATE -------------------------------------------------------------------
65 };
66 
67 #endif
SRF08
The main class of the Arduino library for the SRF08 sensor.
Definition: SRF08.h:30
SRF08::checkIfReadyForReading
bool checkIfReadyForReading()
Checks if the SRF08 is ready to start a new range measurement.
Definition: SRF08.cpp:232
SRF08::startRangeReadingUNSAFE
void startRangeReadingUNSAFE()
Starts a new measurement with the SRF08 sensor if possible, but without blocking features.
Definition: SRF08.cpp:136
SRF08::SRF08
SRF08()
Main constructor of the SRF08 class.
Definition: SRF08.cpp:58
SRF08::startRangeReading
bool startRangeReading()
Starts a new measurement with the SRF08 sensor if possible.
Definition: SRF08.cpp:110
SRF08::readRange
bool readRange()
Reads the current range measurement from the SRF08 sensor if possible.
Definition: SRF08.cpp:155
SRF08::getTimeOfLastReading
uint32_t getTimeOfLastReading()
Get the system time at which the SRF08 sensor started the last range measurement.
Definition: SRF08.cpp:250
SRF08::get_version
uint16_t get_version()
Get the version of the library.
Definition: SRF08.cpp:259
SRF08::readRangeUNSAFE
void readRangeUNSAFE()
Reads the current range measurement from the SRF08 sensor if possible. This Methode allows unsafe ran...
Definition: SRF08.cpp:201
SRF08::~SRF08
~SRF08()
Main destructor of the SRF08 class.
Definition: SRF08.cpp:78
SRF08::getDistance
int16_t getDistance()
Get the last measured distance of the SRF08 sensor.
Definition: SRF08.cpp:241
SRF08::init
void init()
Initialize the SRF08 Sonar Range Finder.
Definition: SRF08.cpp:89