Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Lamp Class Reference

Lamp control interface. More...

#include <c++/Lamp.H>

Collaboration diagram for Lamp:

Collaboration graph
[legend]
List of all members.

Public Types

enum  Port { A, B, C }
 The RCX output pad to which the Lamp is connected. More...


Public Member Functions

 Lamp (enum Port port)
 construct a lamp connected to {port}

 ~Lamp ()
 destroy our lamp instance

const void on () const
 Turn the Lamp on.

const void off () const
 Turn the Lamp off.

const void brightness (const unsigned char level) const
 Set the power to the lamp.


Private Member Functions

const void speed (const unsigned char speed) const
const void direction (const MotorDirection dir) const

Private Attributes

void(* ms )(unsigned char speed)
void(* md )(const MotorDirection dir)

Detailed Description

Lamp control interface.

Define a lamp connection to the RCX so we can turn the lamp on(), off() or set its brightness().

Note:
Lamps are controlled via motor ports so this is based on the Motor.H code
See also:
The other control classes: Motor, MotorPair, Sound

Definition at line 39 of file Lamp.H.


Member Enumeration Documentation

enum Lamp::Port
 

The RCX output pad to which the Lamp is connected.

Enumeration values:
A  RCX output pad A.
B  RCX output pad B.
C  RCX output pad C.

Definition at line 44 of file Lamp.H.


Constructor & Destructor Documentation

Lamp::Lamp enum Port  port  )  [inline]
 

construct a lamp connected to {port}

Parameters:
port designator of pad to which this lamp is connected

Definition at line 54 of file Lamp.H.

References A, B, md, motor_a_dir(), motor_a_speed(), motor_b_dir(), motor_b_speed(), motor_c_dir(), motor_c_speed(), and ms.

Lamp::~Lamp  )  [inline]
 

destroy our lamp instance

Note:
the lamp is turned off when the instance is destroyed

Definition at line 66 of file Lamp.H.

References off().


Member Function Documentation

const void Lamp::brightness const unsigned char  level  )  const [inline]
 

Set the power to the lamp.

Parameters:
level the desired power setting specifying the intensity of the light. [must be between min (0) and max (255)]
Returns:
Nothing

Definition at line 83 of file Lamp.H.

References speed().

const void Lamp::direction const MotorDirection  dir  )  const [inline, private]
 

Definition at line 86 of file Lamp.H.

Referenced by off(), and on().

const void Lamp::off  )  const [inline]
 

Turn the Lamp off.

Returns:
Nothing

Definition at line 76 of file Lamp.H.

References direction(), and off.

Referenced by ~Lamp().

const void Lamp::on  )  const [inline]
 

Turn the Lamp on.

Returns:
Nothing

Definition at line 71 of file Lamp.H.

References direction(), and fwd.

const void Lamp::speed const unsigned char  speed  )  const [inline, private]
 

Definition at line 85 of file Lamp.H.

Referenced by brightness().


Member Data Documentation

void(* Lamp::md)(const MotorDirection dir) [private]
 

Referenced by Lamp().

void(* Lamp::ms)(unsigned char speed) [private]
 

Referenced by Lamp().


The documentation for this class was generated from the following file:
brickOS is released under the Mozilla Public License.
Original code copyright 1998-2002 by the authors.

Generated on Mon Feb 16 21:02:34 2004 for brickOS Kernel Developer by doxygen 1.3.5