Using the Phidgets LCD With Outlook

February 26, 2009 | By

Phidgets LCD

When I got my Phidgets StarterKit I decided to use the LCD that came with it with the Outlook Addin I developed for my previous post Capturing Outlook 2007’s New Mail and Reminder Events. The LCD connects to the PC through USB. It has no memory, so the control program runs on the PC. The libraries needed to develop programs for the hardware can be downloaded from their website along with some sample code too.

The Windows driver installs the .NET assemblies needed to interface with the hardware. Just import Phidgets and Phidgets.Events and you are set. The following code declares a field of type TextLCD and initializes the delegates for the events raised by the LCD. The ErrorEventHandler, AttachEventHandler and DetachEventHandler are the events that occur when the LCD is connected locally. There are two more events (ServerConnect and ServerDisconnect) that can be used when the LCD is connected to another computer. The ErrorEventHandler occurs when the library can not access the LCD, the AttachEventHandler occurs when it is plugged into the USB and DetachEventHandler occurs when it is unplugged from the USB.

The NewMailEx event occurs when one or more new emails are received since the last time it was fired. The EntryID parameter contains a comma separated list of the emails’ IDs. For this example I assumed one email was sent so I did not split the contents of EntryID into an array before retrieving the MailItem object. The rows string array contains two elements (one for each line of the LCD) and assigning a string to an element will display its contents. The LCD’s lines are 20 characters long, if the assigned string is larger it will be trimmed.

The ReminderFire occurs right before the reminder is executed. The parameter is a Reminder object that contains all the details. I created the FlashLCD function to make every message displayed on the LCD stay for 10 seconds. This way I could use the LCD with other applications without overlapping messages. The flashing itself is done by setting the Backlight property to true and false to turn the back light on and off.


Download Source Code


Filed in: WinForms | Tags: , ,

Comments (1)

Links to this Post

  1. DotNetShoutout | April 24, 2009