Page 124 - 15 Dangerously Mad Projects for the Evil Genius
P. 124

Chapter 8    ■   Persistence-of-Vision Display     103













































         Figure 8-34   Modifying the message


        can find this tool on the book’s web site at       constructing an image by turning LEDs on and off
        www.dangerouslymad.com.                            as they move past the observer’s field of view.
                                                             Figure 8-35 illustrates this point.

        Theory
                                                           The Software
        This project includes some interesting bits of
                                                           The Arduino sketch for the Persistence of Vision
        theory. There is the psychological persistence-of-
                                                           project in shown in Listing 8-1 on the next page.
        vision effect, and the software to achieve the
        effect, as well as the use of pulse width modulation  The first line of the program, or “sketch” as they
        (PWM) to control the speed of a motor.             are known in the Arduino community, sets the
                                                           “period” in microseconds between displaying each
                                                           successive column. You can experiment with
        POV
                                                           changing this value.
        This project works for the same reason that movies
                                                             We then define a two-dimensional array to
        work. If images are presented to the brain faster
                                                           represent the Arduino pins used by the LEDs. The
        than around 25 frames per second, then we
                                                           first dimension is the LED’s row and the second is
        interpret the image as moving. In this case, we are
                                                           the individual red, green, or blue element within
        not presenting a whole image at once, but rather
                                                           the LED. So, as we know from the wiring diagram,
   119   120   121   122   123   124   125   126   127   128   129