This library contains all the functions necesary to perform an application using the SRF02 sensor. Esta librería contiene los métodos necesarios para poder configurar todos los parámetros del sensor SRF02.

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers SRF02.h Source File

SRF02.h

00001 #ifndef SRF02_H
00002 #define SRF02_H
00003 
00004 #include "mbed.h"
00005 
00006 
00007 
00008 class SRF02
00009 {
00010 public:
00011   //!Creates an instance of the class.
00012   /*!
00013   Connect module at I2C address addr using I2C port pins sda and scl.
00014   SRF08
00015   */
00016   SRF02(PinName sda, PinName scl, int addr);
00017   
00018   /*!
00019   Destroys instance.
00020   */ 
00021   ~SRF02();
00022   
00023   
00024   int readcm();     //Read the range data in centimeters
00025  
00026   int readinch();   //Read the range data in inches
00027   
00028   void change_addr(char new_addr);      //Change the adress of the device. This is very usefull when there are more sensors.
00029                                         //This function must be executed with only one sensor conected.
00030   
00031   
00032 private:
00033   I2C m_i2c;
00034   int m_addr;
00035 
00036 };
00037 
00038 #endif