CC 3.12 : Computers and Art
Fall 2007
Unit G : Lab G4

INFORMATION

INSTRUCTIONS
  1. In this lab, we will be programming light patterns for the light control board that I have brought in.
  2. YOU WILL BE TURNING IN THE PROCESSING PROGRAM FOR YOUR LIGHT PATTERN, BE SURE TO SAVE THIS ON YOUR USB KEY.
  3. Also, write the answers to the Questions in a text file named yourname-question.txt.
  4. You will be turning the Processing Program and the Questions in with HW G Part 2
    DON"T TURN IN THE MATERIALS SEPERATELY!!!!
  5. Although you do not have the light control board at home to see your patterns on, you can work on the patterns in the emulator program in Steps 1 - 3.

    Physical Computing - Light Control

    Step 1. Download the Emulator Program

    a. Check if the folder LightEmulator exists in the PersistentStorage > Shared folder on your Mac. This is the same folder that Processing 0125 is installed in.

    b. If the folder does not exist, download LightEmulator.dmg (this file is called a DISK IMAGE, it's like a Virtual Flash Drive).

    c. Double click on the .dmg file, this will open the DISK IMAGE

    d. DRAG the folder named LightEmulator from the DISK IMAGE to the Persistent Storage > Shared folder on your Mac.

    e. Close the DISK IMAGE window.

    Step 2. Run the LightEmulator Program

    a. Open the LightEmulator Program (LightEmulator.pde) in Processing

    b. The dots at the bottom of the screen that are blinking represent the lights on the light board. You can try out blinking patterns that you can later run on the real Light Board.

    ONLY EDIT THE CODE IN THE draw() FUNCTION!

    You will find two functions being used in the draw() function, delay() and writeLine().

    Question 1. Look up the delay() function in the Processing Reference. What does the delay function do?

    Question 2. The writeLine function turns on and off a light. Look at the end of the Processing Program where the writeLine function is defined. From the comments, what do the two parameters to the writeLine function do?

    Step 3. Edit the LightEmulator Program

    1. Change the pattern so that you blink all of the lights on and off in a row from Light 1 to Light 16. (Hint: could you use a while() loop to save yourself some anguish of writing all of the functions out explicitly?)

    Save As.. this sketch, naming it yourname-Blink, (i.e. my sketch would be called Chipp-Blink).

    Turn this sketch (yourname-Blink) in with your HW G Part II

    Step 4. Make-Your-Own Lighting Pattern

    1. Work on your own lighting pattern that you would like to see running on the lighting board. Get the timing just right in the Emulator Program and make sure it's properly tested before running it once (we will only have time for everybody to run their program once!).
    2. Be creative! You can also have things drawn in the Processing Sketch window along with the lighting pattern.

    Step 5. Submit Your Pattern

    1. Once you are done and satisified with your lighting pattern.
    2. Copy ONLY the setup() and the draw() functions from your lighting Pattern into the body of an e-mail and e-mail it to me: chipp@sci.brooklyn.cuny.edu
    3. In the ordert that I receive them, I will load them up on lighting board and we can try them out.

    Step 6. User Control

    1. Instead of having a Lightning Pattern that runs automatically, you can have one that responds to a user's input with the mouse (using the mouseX, mouseY, or mousePressed)
    2. Write a Light Control program that turns a light on or off when the user clicks on a button in the sketch window, or when the user moves the mouse.
    3. Alternatively, you could use the mouseX, and mouseY variables in the delay() functions to control the speed of the light blinking pattern.
    4. When you have a working User Control program send it to me and we can test it out on the light board.