Marco Oehler / Mbed 2 deprecated Lab2

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

IRSensor Class Reference

IRSensor Class Reference

This class implements a driver to read the distance sensors of the ROME2 mobile robot. More...

#include <IRSensor.h>

Public Member Functions

 IRSensor (AnalogIn &distance, DigitalOut &bit0, DigitalOut &bit1, DigitalOut &bit2, int number)
 Creates and initialises the driver to read the distance sensors.
virtual ~IRSensor ()
 Deletes this IRSensor object and releases all allocated resources.
float read ()
 This method reads from the distance sensor.
 operator float ()
 The empty operator is a shorthand notation of the read() method.

Detailed Description

This class implements a driver to read the distance sensors of the ROME2 mobile robot.

Definition at line 17 of file IRSensor.h.


Constructor & Destructor Documentation

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

Creates and initialises the driver to read the distance sensors.

Parameters:
distancethe analog input to read a distance value from.
bit0a digital output to control the multiplexer.
bit1a digital output to control the multiplexer.
bit2a digital output to control the multiplexer.
numberthe number of the sensor. This value must be between 0 and 5.

Definition at line 20 of file IRSensor.cpp.

~IRSensor (  ) [virtual]

Deletes this IRSensor object and releases all allocated resources.

Definition at line 28 of file IRSensor.cpp.


Member Function Documentation

operator float (  )

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

Definition at line 48 of file IRSensor.cpp.

float read (  )

This method reads from the distance sensor.

Returns:
a distance value, given in [m].

Definition at line 34 of file IRSensor.cpp.