Ledstrip gradient generation

For my ledclock I’ve implemented a little datatransfer. But I want to have a gradient on my clock. My data transfer implementation is quite simple, first the command leddata than it will follow with all the data.

To achieve this without to much effort I did the following:

  • Open gimp and create a file of 60×1 pixels.
  • Select the gradient tool
  • Export the file as 24 bits bitmap, 8 bit Red 8 bit Blue 8 bit Green to /tmp/test.bmp
    • Note that bmp orients the data in the file as gbr instead of rgb.
  • tail -c -180 /tmp/test.bmp > /tmp/leddata_test
    • A bitmap is constructed of a header and then rgb data. In this case I have 60 pixels of 1 byte per color so 60 * 3 bytes represent the gradient.
    • With the use of tail -c -180 I start counting backwards 180 bytes which results in the gradient data in /tmp/leddata_test
  • open cutecom
  • send the command leddata
  • use cutecom to transfer the data as plain and bobs your uncle
Posted in Uncategorized.