LED Number Display for the Handy Cricket
How to Use the Display
Plugging It In
The 4-Digit LED Display for the Handy Cricket is quite easy to use. Start off by plugging it into your Handy Cricket. You can use either bus port they're both the same.
Turn on the Cricket, and the display should show a rectangle of illuminated segments. This is its power-on indicator.
Displaying NumbersNow copy the following Logo driver procedure into your Cricket Programs window:
Download to put this program into the Cricket, and then try it out using the Command Center. Type:
and you should see the number 7 on the display!
Displaying Sensor Values
Let's try something more useful like displaying a sensor value. Find a Cricket light sensor and plug it into sensor port A. Now type the following statement into the Command Center:
loop [display sensora wait 1]
The display will now continuously show the value of sensor A, updating ten times per second.
It's possible to adjust the brightness of the digits on the Display. When the Display is first turned on, it uses a mid-range level which is a good compromise between brightness and battery drain.
But you can adjust the brightness up and down depending on your application. Copy the following procedure into the Cricket Programs window:
Brightness levels range from 1 (least brightness) to 7 (highest brightness). When the Display is first turned on, it is set to brightness level 4.
In order to preserve battery power, the Display will automatically turn off a minute after the last time it receives a command. If you have an application that requires the display to be on continually, simply put the display command into a loop so that it's issued more than once a minute, and your display will stay on.
That's all there is to it! There are some advanced features, which are described below, but for basic use of the Handy Cricket LED Number Display, you are already set.
This section explains three advanced modes of the Handy Cricket LED Number Display:
Displaying Hexadecimal Numbers
The LED Number Display can show the Cricket's 16-bit values in a hexadecimal format. This is useful for displaying numbers outside of the 0 to 9999 decimal range, or for displaying values that are easier to read if show in hex.
The following driver program tells the display to show a value in hexadecimal:
Displaying Arbitrary Patterns
The LED Number Display has a mode that lets you decide exactly which segments to light up. This lets you make arbitrary patterns or display alphabetic-style information.
The following display-bits procedure does the magic:
The display-bits procedure takes four inputsa byte for each of the four 7-segment displays. Each byte controls the 7 segments of a digit according to the following diagram:
bit 0 ---------- | | | | 5 | | 1 | 6 | ---------- | | | | 4 | | 2 | 3 | ----------
So, for example, to form the uppercase letter 'A,' (all segments but bit 3 lit), one would use the value $77 (the '$' symbol in Cricket Logo indicates a hexadecimal value).
For another example, the following procedure call will show 'Abcd' on the display:
display-bits $77 $7c $58 $5e
All sorts of uses are possible using this display mode.
Using Two Displays on One Cricket
There are two aspects to using two Displays from a single Cricket. First, a Display must have its address ID changed from the default ID of 1 to the optional ID of 2. Second, a slightly different set of procedures must be used for addressing the two displays.
Changing Address ID to 2. When shipped from the factory, all Displays are set to address 1. By cutting a trace and installing a jumper, a Display can be set to address 2. Then, two displays on connected to the same Cricket (one with address 1, and the other with address 2) can be issued commands independently.
The image below shows where to make the modifications to a Display to change it to address 2. The image is from the upper right corner of the Display, when viewed from the back:
Driver Procedures for Displays 1 and 2. The driver programs provided so far will work with a display set to either address ID 1 or 2. In order to separately issue commands to a particular display, different procedures must be used. Here they are: