Hologram Lamp – Coding

The hologram lamp construction turns our basic CODEBOX Tv display into something completely different, and also really amazing. This lamp not only glows, but it also creates an effect of a hologram almost floating in the air.

This effect, best observed in a dark room, is created by backlighting the transparent acrylic glass from the bottom, which makes the edges of the engraved pattern stand out from the rest of the acrylic sheet.

In the examples below, you will see some different ways we can animate the backlight of our hologram.

Connecting electronic modules

  • Display → OUTPUT 3.
  • Power → USB cable → computer.

The code

Our hologram is a flat sheet of acrylic glass. If we place it vertically on the display, it covers only one line of LED diodes, and because of that, we will turn on only the fifth line of LEDs which sits directly below the acrylic glass. To turn on the right LEDs, we will set the RECTANGLE block width to 8, height to 1, and we will draw it in Y=4 (which is the fifth line counting from position 0 on the display).

When you play this program, it should light up the hologram with white light. But we can add some more dynamics to it, by making the hologram turn on and off like traffic lights.

Let’s do some more experiments. We’ll make the hologram light up in a random color each time it turns on:

Example 2 – fluent color change

Now, let’s program our hologram lamp to gradually change the hue. To do this, we will use the RAINBOW COLOR block.

To make the color change automatically, we are going to create an X variable and increase its value by 1 with every loop execution. If we use the variable as the parameter in the RAINBOW COLOR block, the color of our backlight will change fluently. The speed of the color change can be controlled by the block WAIT at the end of the program – the bigger the value, the slower the rate.

Example 3 – moving backlight

For our last example, we are going to program a backlight for the hologram that moves left to right and back. Again, we will use a variable. This time the variable will define the location of a 2×1 pixels rectangle which will move from left to right (we will change its position in the X-axis).

wyswietlacz_uklad_strzalka

Since the width of the rectangle is 2 pixels, the rectangle reaches the edge of the display in position X=6 (remember, that pixels on the display are numbered from 0 to 7). In order to achieve fluent movement, we’re setting the REPEAT loop to 6 repeats. Inside the loop, we’re increasing the X by 1 and then decreasing the X by 1 which in effect gives us that move from left to right and back to the beginning.