TeamSurface / Library

Fork of Library by St Knz

Embed: (wiki syntax)

« Back to documentation index

IRSensor Class Reference

IRSensor Class Reference

This is a device driver class to read the distance measured with a Sharp IR sensor. More...

#include <IRSensor.h>

Public Member Functions

 IRSensor (AnalogIn &distance, DigitalOut &bit0, DigitalOut &bit1, DigitalOut &bit2, int number)
 Creates an IRSensor object.
virtual ~IRSensor ()
 Deletes the IRSensor object.
float read ()
 Gets the distance measured with the IR sensor in [m].
 operator float ()
 The empty operator is a shorthand notation of the read() method.

Detailed Description

This is a device driver class to read the distance measured with a Sharp IR sensor.

Definition at line 16 of file IRSensor.h.


Constructor & Destructor Documentation

IRSensor ( AnalogIn &  distance,
DigitalOut &  bit0,
DigitalOut &  bit1,
DigitalOut &  bit2,
int  number 
)

Creates an IRSensor object.

Parameters:
distancean analog input object to read the voltage of the sensor.
bit0a digital output to set the first bit of the multiplexer.
bit1a digital output to set the second bit of the multiplexer.
bit2a digital output to set the third bit of the multiplexer.
numberthe number of the sensor, either 0, 1, 2, 3, 4 or 5.

Definition at line 20 of file IRSensor.cpp.

~IRSensor (  ) [virtual]

Deletes the IRSensor object.

Definition at line 30 of file IRSensor.cpp.


Member Function Documentation

operator float (  )

The empty operator is a shorthand notation of the read() method.

Definition at line 50 of file IRSensor.cpp.

float read (  )

Gets the distance measured with the IR sensor in [m].

Returns:
the distance, given in [m].

Definition at line 36 of file IRSensor.cpp.