MatrixMiniR4 1.1.4
Matrix Mini R4 Arduino Library API Documentation
Loading...
Searching...
No Matches
MiniR4LaserSensorExt.h
Go to the documentation of this file.
1
6#ifndef _MiniR4LaserSensorExt_H_
7#define _MiniR4LaserSensorExt_H_
8
9#include <Arduino.h>
10#include <Wire.h>
11
12#ifndef ADDR_PCA954X
13# define ADDR_PCA954X 0x70
14#endif
15
16#define MatrixLaser_ADDR 0x26
17
25{
26private:
27 typedef enum __LaserRegType
28 {
29 Device_ID = 1,
30 Device_CONFIG,
31 Distance_H,
32 Distance_L
33 } LaserRegType;
34
35 uint8_t i2cReadData(LaserRegType reg);
36 void i2cMUXSelect();
37 void i2cWriteData(LaserRegType reg, uint8_t data);
38
39public:
40 uint8_t _ch = 0;
41 TwoWire* _pWire;
42
48 bool begin();
49
55 uint16_t getDistance();
56};
57
58#endif
Class for interfacing with a laser distance sensor.
bool begin()
Initializes the laser sensor.
uint16_t getDistance()
Gets the distance measured by the laser sensor.