stamp.peripheral.appmod
Class LedTerminal

java.lang.Object
  |
  +--stamp.peripheral.appmod.LedTerminal

public class LedTerminal
extends Object

This LedTerminal class is for Parallax's "LED Terminal AppMod" (part #29112)

The LED Terminal AppMod provides an interface for direct interaction between a user and the host. It offers a four digit alphanumeric LED display, six individual LEDs, four pushbuttons, and a real-time clock.

Communication with the AppMod is performed, serially, via the Javelin's I/O pin #6 using the UART class. Most of the LED Terminal features are available to you through methods within the LedTerminal class. If you would like to experiment with the AppMods other program strings, they are as follows: (Note: All data must be sent as characters, in one continuous string)

 ASC - Send ASCII (text) data as well as LED control to the AppMod
       (4 char)(3 char)    (4 char)     (1 char)       (1 char)
       [init]  [directive] [ASCII Data] [LED highbyte] [LED lowbyte]
       !LT0    ASC         data         0x00           0x00

 BCD - Show Binary Coded Decimal data as received via serial interface.
       Note: data will be displayed as Hex values 0-9, A-F
       (4 char)(3 char)    (4 char)      (1 char)       (1 char)
       [init]  [directive] [binary Data] [LED highbyte] [LED lowbyte]
       !LT0    BCD         data          0x00           0x00

 BIN - Show decimal value of HEX input.
       Note: data consists of 2 bytes (0-270F)
             will be converted to decimal (0-9999)
       (4 char)(3 char)    (2 char)      (1 char)       (1 char)
       [init]  [directive] [binary Data] [LED highbyte] [LED lowbyte]
       !LT0    BIN         byte,byte     0x00           0x00

 RTI - Real-Time clock Initilization.  Set the real-time clock.
       (4 char)(3 char)    (4 char)         (2 char)
       [init]  [directive] [binary Data]    [unused]
       !LT0    RTI         day,hour,min,sec 0x00,0x00

 RTH - Real-Time clock Hide.  Do not display real-time clock.
       (4 char)(3 char)
       [init]  [directive]
       !LT0    RTH

 RTS - Real-Time clock Show.  Display the real-time clock.
       (4 char)(3 char)
       [init]  [directive]
       !LT0    RTS

 To control the LED's you will need two bytes: highbyte & lowbyte
 highbyte lowbyte
 XXXXXX00 00000000
       || |||||||`-> Decimal Point #1 (Right-most, Least Significant digit)
       || ||||||`--> Decimal Point #2                 .
       || |||||`---> Decimal Point #3                 .
       || ||||`----> Decimal Point #4 (Left-most, Most Significant digit)
       || |||`-----> LED #1 (Right-most)
       || ||`------> LED #2      .
       || |`-------> LED #3      .
       || `--------> LED #4 (Left-most)
       |'----------> Colon mini-LED (top)
       `-----------> Colon mini-LED (bottom)
 

Note: The Javelin's current UART class version 1.0 (IDEv2.01) is designed for single-direction communication on a given I/O pin. With this limitation, the LedTerminal.java class can not receive serial data from the Led Terminal AppMod (such as the state of the buttons)


Field Summary
static boolean colonBot
          Colon (Bottom)
static boolean colonTop
          Colon (Top)
static boolean dec1
          Decimal LED Display #1 (Right most)
static boolean dec2
          Decimal LED Display #2 (2nd from right)
static boolean dec3
          Decimal LED Display #3 (2nd from left)
static boolean dec4
          Decimal LED Display #4 (Left most)
static boolean led1
          Discrete LED #1 (Right most)
static boolean led2
          Discrete LED #2 (2nd from right)
static boolean led3
          Discrete LED #3 (2nd from left)
static boolean led4
          Discrete LED #4 - (Left Most)
static char zero
          Null character
 
Method Summary
 void banner(String s, int wait)
          Scrolls a message across the display.
 void clear()
          This will turn all LEDs off and clear the screen.
 void direct(String xmit)
          This routine will give you direct access over the AppMod.
 void direct(StringBuffer xmit)
          This routine will give you direct access over the AppMod.
 void display(String msg, int wait)
          This will display a message.
 void displayTime(boolean display)
          This method will display or hide the time
 void setTime(int day, int hour, int min, int sec)
          The setTime method will set the internal clock, and display it.
 
Methods inherited from class java.lang.Object
equals
 

Field Detail

zero

public static final char zero
Null character

dec1

public static boolean dec1
Decimal LED Display #1 (Right most)

dec2

public static boolean dec2
Decimal LED Display #2 (2nd from right)

dec3

public static boolean dec3
Decimal LED Display #3 (2nd from left)

dec4

public static boolean dec4
Decimal LED Display #4 (Left most)

led1

public static boolean led1
Discrete LED #1 (Right most)

led2

public static boolean led2
Discrete LED #2 (2nd from right)

led3

public static boolean led3
Discrete LED #3 (2nd from left)

led4

public static boolean led4
Discrete LED #4 - (Left Most)

colonTop

public static boolean colonTop
Colon (Top)

colonBot

public static boolean colonBot
Colon (Bottom)
Method Detail

banner

public void banner(String s,
                   int wait)
Scrolls a message across the display. Will accept a String of any length, will automatically pad the begining and ending of the String.

String s="Parallax Inc"; msg.banner(s,4000);

Parameters:
s - String to be scrolled
wait - delay: 1 unit ~ 1/10 milisecond

direct

public void direct(StringBuffer xmit)
This routine will give you direct access over the AppMod.
Parameters:
xmit - - Constructed data packet to be transmitted

direct

public void direct(String xmit)
This routine will give you direct access over the AppMod.
Parameters:
xmit - - Constructed data packet to be transmitted

display

public void display(String msg,
                    int wait)
This will display a message. If the input String is greater than 4 characters, it will be truncated to 4 characters. If the input string is less than 4 characters the output will be right justified.
Parameters:
msg - Message to be displayed
wait - delay: 1 unit ~ 1/10 milisecond

clear

public void clear()
This will turn all LEDs off and clear the screen.

setTime

public void setTime(int day,
                    int hour,
                    int min,
                    int sec)
The setTime method will set the internal clock, and display it. When this device is communicating with the stamp, its internal clock will halt. When communication is complete, it will try to estimate the correct time and adjust. For most accurate time, keep communication with AppMod to a minimum.
Parameters:
day - Time in day(s): 0-99
hour - Time in hour(s): 0-23
min - Time in minute(s): 0-59
sec - Time in second(s): 0-59

displayTime

public void displayTime(boolean display)
This method will display or hide the time
Parameters:
display - - Set TRUE to display time, set to FALSE to hide time