I got my Javelin Stamp microprocessor the other day, and have converted my Basic Stamp 2 project code to Java. The wiring is exactly the same. All I did was pop out the BS2 chip and pop in the Javelin. Well, that and rewrite the code. I decided to create a class to represent the LED as an object. I had a few requirements in mind:
- The class had to be reusable for any seven-segment LED display. This requires creating an internal, logical segment map. The physical I/O pin mapping to each logical segment is provided by the user of this reusable class.
- The class had to be easy to use. Something like:
- Create an instance of the class
- Provide the physical I/O pin-to-segment mapping in a very simple way
- Call a method and pass it the number (0-9) to be displayed
I thought about submitting my new class as a candidate for consideration as a Javelin library, but it’s really too simple. I don’t figure they’re gonna want it.
So, here’s a picture of the setup:
Here’s a link to the source code:
This was fun. Next: writing a Java program to make the Javelin act as a controller for a 12 key matrix encoded keypad.
Pingback: j steven perry, the blog » 12 key Matrix-Enabled Keypad Project