Display librairy manage 3 LED and a TextLCD (on, off, flash) (print message, clear)

Embed: (wiki syntax)

« Back to documentation index

Display Class Reference

Display Class Reference

This class manage 3 LED and 1 TextLCD display. More...

#include <Display.h>

Public Types

enum  choiceStatusLED { on, off, flash }
 

use by printMessage() and changeStatusLed()

More...

Public Member Functions

 Display (PinName pinGreenLED, PinName pinRedLED, PinName pinOrangeLED, PinName pinLCDrs, PinName pinLCDe, PinName pinLCDd0, PinName pinLCDd1, PinName pinLCDd2, PinName pinLCDd3)
 Create a Display interface (default : 16X2 screen)
 Display (PinName pinGreenLED, PinName pinRedLED, PinName pinOrangeLED, PinName pinLCDrs, PinName pinLCDe, PinName pinLCDd0, PinName pinLCDd1, PinName pinLCDd2, PinName pinLCDd3, TextLCD::LCDType typeScreen)
 Create a Display interface.
 ~Display (void)
 Destructor.
void printMessage (string message, choiceStatusLED statusGreenLED, choiceStatusLED statusRedLED, choiceStatusLED statusOrangeLED)
 print message on LCD screen and change status of green, red and orange LED.
void clear (void)
 put off 3 LED and clear LCD screen

Detailed Description

This class manage 3 LED and 1 TextLCD display.

She permit to print messages and to light or flash LED.

 #include "mbed.h"
 #include "Display.h"

 Display disp(p12, p13, p14, p15, p16, p5, p6, p7, p8); // greenLED, redLED, orangeLED, LCD : rs, e, d4-d7 (default : 16X2 screen)

 float delay = 3;


 int main() {

   // print "HelloWorld !" on LCD screen and put on greenLED, flash redLED and put off orangeLED 
   disp.printMessage("Hello World !", Display::on, Display::flash, Display::off);
   wait(delay);
   
   // print "coucou !" on LCD screen and put off greenLED, put on redLED and flash orangeLED
   disp.printMessage("coucou !", Display::off, Display::on, Display::flash);
   wait(delay);
   
   // print "bye bye !" on LCD screen and flash greenLED, put off redLED and put on orangeLED
   disp.printMessage("bye bye !", Display::flash, Display::off, Display::on);
   wait(delay);

   // clear LCD screen and shutdown 3 LED
   disp.clear();
 }

Definition at line 53 of file Display.h.


Member Enumeration Documentation

use by printMessage() and changeStatusLed()

Enumerator:
on 

put on led

off 

put off led

flash 

flash led

Definition at line 58 of file Display.h.


Constructor & Destructor Documentation

Display ( PinName  pinGreenLED,
PinName  pinRedLED,
PinName  pinOrangeLED,
PinName  pinLCDrs,
PinName  pinLCDe,
PinName  pinLCDd0,
PinName  pinLCDd1,
PinName  pinLCDd2,
PinName  pinLCDd3 
)

Create a Display interface (default : 16X2 screen)

Parameters:
pinGreenLEDgreenLED broche
pinRedLEDredLED broche
pinOrangeLEDorangeLED broche
pinLCDrsLCD Instruction/data control line
pinLCDeLCD Enable line (clock)
pinLCDd0-d3LCD Data lines

Definition at line 13 of file Display.cpp.

Display ( PinName  pinGreenLED,
PinName  pinRedLED,
PinName  pinOrangeLED,
PinName  pinLCDrs,
PinName  pinLCDe,
PinName  pinLCDd0,
PinName  pinLCDd1,
PinName  pinLCDd2,
PinName  pinLCDd3,
TextLCD::LCDType  typeScreen 
)

Create a Display interface.

Parameters:
pinGreenLEDgreenLED broche
pinRedLEDredLED broche
pinOrangeLEDorangeLED broche
pinLCDrsLCD Instruction/data control line
pinLCDeLCD Enable line (clock)
pinLCDd0-d3LCD Data lines
typeScreenLCD Sets the panel size/addressing mode (default = LCD16x2)

Definition at line 30 of file Display.cpp.

~Display ( void   )

Destructor.

Definition at line 40 of file Display.cpp.


Member Function Documentation

void clear ( void   )

put off 3 LED and clear LCD screen

Definition at line 73 of file Display.cpp.

void printMessage ( string  message,
choiceStatusLED  statusGreenLED,
choiceStatusLED  statusRedLED,
choiceStatusLED  statusOrangeLED 
)

print message on LCD screen and change status of green, red and orange LED.

all line except the last line, have to finish by CRLF. Warning : CRLF count like a character. don't end message by CRLF. examples :
"this line have to finish by CRLF\/n and next too\/n but not the last"

Parameters:
messagemessage will be display on screen
statusGreenLEDnew status of greenLED (on, off, flash)
statusRedLEDnew status of redLED (on, off, flash)
statusOrangeLEDnew status of orangeLED (on, off, flash)

Definition at line 53 of file Display.cpp.