Robot team project

Dependencies:   QEI Motordriver ros_lib_melodic

Revision:
5:8ef79eebbc97
Parent:
4:cb50c6fa340b
diff -r cb50c6fa340b -r 8ef79eebbc97 sensor/Sensor.h
--- a/sensor/Sensor.h	Tue Oct 22 11:52:32 2019 +0000
+++ b/sensor/Sensor.h	Tue Oct 22 15:06:44 2019 +0000
@@ -71,7 +71,8 @@
 class Sensor{
     
 public:
-    /** Create a VL6180 object at I2C specified address (7 bit).
+    /** Constructor
+    * Create a VL6180 object at I2C specified address (7 bit).
     * 
     * @param sda I2C sda pin number
     * @param scl I2C scl pin number
@@ -79,21 +80,22 @@
     */
     Sensor(PinName sda, PinName scl, PinName shdn);
     
-    /** Init the sensor and load settings
+    /** Init the sensor, load settings and change I2C address
     *
+    * @param address I2C new address
     */
     int init();
     
+    /** Change I2C address
+    * 
+    */
+    void changeAddress(char address);
+    
     /** Make a range reading
     *
     */
     float read();
     
-    /** Change I2C address
-    * 
-    */
-    void changeAddress(char address);
-    
     /** Turn off the device
     *   
     */
@@ -103,11 +105,18 @@
     * 
     */
     void turnOn();
+    
+    /** Indicate if the device detects an obstacle
+    *
+    *   @return true if osbtacle otherwise false
+    */
+    bool getIsObstacle();
         
 private:
     char addr;
     I2C i2c;
     DigitalOut SHDN;
+    bool isObstacle;
     void startRange();
     void pollRange();
     float readRange();