Re: RGB LED's
- From: Nobody <nobody@xxxxxxxxxxx>
- Date: Thu, 22 Jan 2009 15:55:39 +0000
On Thu, 22 Jan 2009 13:12:20 +0000, Jan Panteltje wrote:
What I want to solder together one of these days is a simple PIC
with 3 PWM outputs driving those 3 LEDS, and RS232 in, accepting the
appended list.
[X11's rgb.txt file]
So you can then send for example 238 232 170, and get the color 'pale
goldenrod', or ask for 'pale goldenrod' and the LEDs are set that way.
Should not be too difficult to program, hope PIC is big enough for all
those strings... that table is 17371 bytes... mmm, need external memory
or bigger PIC perhaps.
You don't need to store the entire table as raw ASCII.
For a start, 11 bytes (3+1+3+1+3) for the RGB is excessive.
If you don't need to reject invalid values, you can just store an array of
RGB triples indexed using a hash of the string. 657 distinct strings @ 3
bytes each = 1971 bytes.
Even if you need to store all of the strings, there's a lot of scope
for compression. gzipping the raw table comes out at 1715 bytes; I don't
know how much space a gzip decompressor would take, but LZW is pretty
trivial (and no longer patented).
You may be able to improve compression further by taking advantage of the
nature of the data, e.g.:
You can lose 101 entries if you equate grey/gray in code.
You can omit the versions with spaces (their RGB values are identical to
those without spaces) and strip spaces on input. Or omit those without
spaces and skip the space when checking.
You only need [A-WZ0-9] (no X) without case sensitivity, 35 values = 5.17
bits/char = 6 chars in a 32-bit word.
If you store the table alphabetically, you can use an encoding which takes
advantage of similarities in consecutive entries (e.g. a code to indicate
that the first N characters are identical to the previous name).
Or just find yourself a "demo" coder; a decent one could probably get both
data and code into less than 1KiB.
Or put the table on the PC side and just send the numbers, using a small
PIC.
This is part of the Linux distribution, and as such copyright of Xorg,
and likely GPL:
X is MIT-licensed, which means you can do what you want so long as you
don't remove any copyright notice or warranty disclaimer. You'll find the
same file included with commercial versions of X.
.
- Follow-Ups:
- RGB LED PIC controlled via RS232 from the PC
- From: Jan Panteltje
- Re: RGB LED's
- From: Jan Panteltje
- Re: RGB LED's
- From: Frank Buss
- Re: RGB LED's
- From: Jan Panteltje
- Re: RGB LED's
- From: Jan Panteltje
- RGB LED PIC controlled via RS232 from the PC
- References:
- RGB LED's
- From: Jon Slaughter
- Re: RGB LED's
- From: Don Klipstein
- Re: RGB LED's
- From: Jan Panteltje
- RGB LED's
- Prev by Date: Re: OT: So, is everybody looking forward to the Obama-nation?
- Next by Date: Re: Microwaving a Ferrite Toroid
- Previous by thread: Re: RGB LED's
- Next by thread: Re: RGB LED's
- Index(es):
Relevant Pages
|
Loading