Monday
Apr252016

Post Full Of Spoilers

Read this at the risk of spoiling everything.  I would avoid it if you can.

Last night I figured out my code.  Right not it is set up to run two actions on a single strand of LEDs.  Seven LEDs will be designated as display lights for Morse Code which will display a phrase and repeat after the cycle.  The rest of the LEDs are coded to be on at a constant brightness.  I'll tell you what they will all be used for later but at this point they work correctly.  

This code took about 20 hours to sort out and involved information gathered and learned from more then 15 other finished codes found all over the internet.  While each of the codes I found taught me something that pushed me towards my final product, three of them were major pieces to the puzzle as I plugged and played through all of them.  I'm way closer to Arduino literacy then I was with the code for Zed and with help from the many sources I can write commands from scratch.  This allowed me to turn what was originally a much longer script of parts into a nice tight set of commands where instead of having three sepperate sections refer to three sepperate LED actions, I now have one driving it all three.

Here of a video of the lights in action.

 The Guts!

// Think about the space between the repeat.  Longer or not?
// There is a dimming of the pixels that are not involved in the Morse when pulse occurs.  Hoping external power supply fixes issue.
// Think about leaving some light in the low end of the pulse and pauses.
#include <Adafruit_NeoPixel.h>
#define PIN 6
#define NUM_LEDS 8
// Parameter 1 = number of pixels in strip
// Parameter 2 = pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUM_LEDS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}
void loop() {
  RGBLoop();
}
void RGBLoop() {
// Color of strip minus pixels involved in Morse Code
  for (int i = 0; i < NUM_LEDS; i++) {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    strip.setPixelColor(i, strip.Color(255, 255, 255)); // Moderately bright green color.
    strip.show(); // This sends the updated pixel color to the hardware.
  }
// Morse Code "DISPLACEMENT" 
  for (int j = 0; j < 43; j++ ) {
// Fade IN
    for (int k = 0; k < 256; k++) {
      switch (j) {
        case 0: setAlldah(k, k, k); break;
        case 1: setAlldi(k, k, k); break;
        case 2: setAlldi(k, k, k); break;
        case 3: setAllpause(k, k, k); break;
        case 4: setAlldi(k, k, k); break;
        case 5: setAlldi(k, k, k); break;
        case 6: setAllpause(k, k, k); break;
        case 7: setAlldi(k, k, k); break;
        case 8: setAlldi(k, k, k); break;
        case 9: setAlldi(k, k, k); break;
        case 10: setAllpause(k, k, k); break;
        case 11: setAlldi(k, k, k); break;
        case 12: setAlldah(k, k, k); break;
        case 13: setAlldah(k, k, k); break;
        case 14: setAlldi(k, k, k); break;
        case 15: setAllpause(k, k, k); break;
        case 16: setAlldi(k, k, k); break;
        case 17: setAlldah(k, k, k); break;
        case 18: setAlldi(k, k, k); break;
        case 19: setAlldi(k, k, k); break;
        case 20: setAllpause(k, k, k); break;
        case 21: setAlldi(k, k, k); break;
        case 22: setAlldah(k, k, k); break;
        case 23: setAllpause(k, k, k); break;
        case 24: setAlldah(k, k, k); break;
        case 25: setAlldi(k, k, k); break;
        case 26: setAlldah(k, k, k); break;
        case 27: setAlldi(k, k, k); break;
        case 28: setAllpause(k, k, k); break;
        case 29: setAlldi(k, k, k); break;
        case 30: setAllpause(k, k, k); break;
        case 31: setAlldah(k, k, k); break;
        case 32: setAlldah(k, k, k); break;
        case 33: setAllpause(k, k, k); break;
        case 34: setAlldi(k, k, k); break;
        case 35: setAllpause(k, k, k); break;
        case 36: setAlldah(k, k, k); break;
        case 37: setAlldi(k, k, k); break;
        case 38: setAllpause(k, k, k); break;
        case 39: setAlldah(k, k, k); break;
        case 40: setAllpause(k, k, k); break;
        case 41: setAllpause(k, k, k); break;
        case 42: setAllpause(k, k, k); break;
      }
      showStrip();
    }
// Fade OUT
    for (int k = 255; k >= 0; k--) {
      switch (j) {
        case 0: setAlldah(k, k, k); break;
        case 1: setAlldi(k, k, k); break;
        case 2: setAlldi(k, k, k); break;
        case 3: setAllpause(k, k, k); break;
        case 4: setAlldi(k, k, k); break;
        case 5: setAlldi(k, k, k); break;
        case 6: setAllpause(k, k, k); break;
        case 7: setAlldi(k, k, k); break;
        case 8: setAlldi(k, k, k); break;
        case 9: setAlldi(k, k, k); break;
        case 10: setAllpause(k, k, k); break;
        case 11: setAlldi(k, k, k); break;
        case 12: setAlldah(k, k, k); break;
        case 13: setAlldah(k, k, k); break;
        case 14: setAlldi(k, k, k); break;
        case 15: setAllpause(k, k, k); break;
        case 16: setAlldi(k, k, k); break;
        case 17: setAlldah(k, k, k); break;
        case 18: setAlldi(k, k, k); break;
        case 19: setAlldi(k, k, k); break;
        case 20: setAllpause(k, k, k); break;
        case 21: setAlldi(k, k, k); break;
        case 22: setAlldah(k, k, k); break;
        case 23: setAllpause(k, k, k); break;
        case 24: setAlldah(k, k, k); break;
        case 25: setAlldi(k, k, k); break;
        case 26: setAlldah(k, k, k); break;
        case 27: setAlldi(k, k, k); break;
        case 28: setAllpause(k, k, k); break;
        case 29: setAlldi(k, k, k); break;
        case 30: setAllpause(k, k, k); break;
        case 31: setAlldah(k, k, k); break;
        case 32: setAlldah(k, k, k); break;
        case 33: setAllpause(k, k, k); break;
        case 34: setAlldi(k, k, k); break;
        case 35: setAllpause(k, k, k); break;
        case 36: setAlldah(k, k, k); break;
        case 37: setAlldi(k, k, k); break;
        case 38: setAllpause(k, k, k); break;
        case 39: setAlldah(k, k, k); break;
        case 40: setAllpause(k, k, k); break;
        case 41: setAllpause(k, k, k); break;
        case 42: setAllpause(k, k, k); break;
      }
      showStrip();
    }
  }
}
void showStrip() {
#ifdef ADAFRUIT_NEOPIXEL_H
  // NeoPixel
  strip.show();
#endif
}
void setPixel(int Pixel, byte red, byte green, byte blue) {
#ifdef ADAFRUIT_NEOPIXEL_H
  // NeoPixel
  strip.setPixelColor(Pixel, strip.Color(red, green, blue));
#endif
}
// di
void setAlldi(byte red, byte green, byte blue) {
  for (int i = 0; i < 4; i++ ) {
    setPixel(i, red, green, blue);
  }
  showStrip();
  delay(3);
}
// dah
void setAlldah(byte red, byte green, byte blue) {
  for (int i = 0; i < 4; i++ ) {
    setPixel(i, red, green, blue);
  }
  showStrip();
  delay(5);
}
// pause
void setAllpause(byte red, byte green, byte blue) {
  for (int j = 0; j < 4; j++ ) {
    setPixel(j, 0, 0, 0);
  }
  showStrip();
  delay(2);
}

 

Sunday
Apr242016

Code

I don’t expect any of this to make sense because it is a combination of my language and what I think the language of Arduino is.

Code is starting to come together.  I have managed to manipulate a code for pulsing in a way that will cater to parts of another code in a way that will likely emulate its function.  How did I get here.  First I dug through a lot of different codes that allowed me to make a single LED pulse on and off at different intervals.  At first this involved one variable in the form of a delay() command.  This is a good path for allowing a single process to happen.  I need multiple delay() layers.  In the code a number is entered into the parentheses and the delay takes effect based on where it is located in the code.  The below video is an example of code working properly on one LED of a strip.  This LED can be changed to display in any of the LEDs on the strip but only one at a time as writin.  

At this point I ran into major problems getting the code to express on all eight LEDs.  First I had to insert a line that would prompt all eight LEDs.  This involved learning how to articulate a constant and declare said constant as a phrase that would relate to the number of pixels on a strip.  Success and failure both occurred next.  While I was able to get the entire strip to light, the delay effect was passed on from one pixel to the next and the pulsing effect is never really visible.  The video bleow displays this successful failure.

My solution was to work with a more complex code that allows the delay to be independent of the show and specific to the loop that it is tied to.  This allows me to edit the delay involved in display of the entire strip of LEDs rather than one at a time.  This comes about through a combination of a button cycler code and a pulse code where I create a series of events based on void loops that each have independent abilities.  I imagine that my final code will be much more complex version of this.  The trick will be learning ow to get two strips of lens to oporate with two different pulse durations.  I have learned to write the code for simple LEDs but have not tried for smart pixels.  The below video displays a group of three slow pulses, red green, and blue, followed by a set of quicker yellow, aqua, and purple pulses.

Saturday
Apr232016

Glass Straws of Light

Gearing up for the final few weeks and things seem to be moving at the pace they need to.  I have my space mapped out in Accock Gallery and have been able to visualize what I want to do with the space.  I have also began coding for my object.

This time around, compared to coding for “Zed”, has been a lot easier.  I am still running into similar issues converting code from one behaviour to another.  In my case the first issue came from creating a button function that would allow me to turn the light source on and off and to cycle through different colors.  At first I tried to create a code that would toggle a button signal from HIGH to LOW if the previous pressing action signaled HIGH and then default to HIGH otherwise.  I figured out how to get this process to work with a single LED but getting it to communicate with a string of NeoPixels was a problem.  I toyed around with this idea for a bit and then decided to create another code that would work a little different.

Button cycling is a pretty common code in arduino that allows a button to cycle through different actions in a specific order.  Basically you write a few actions and order them in the way you want and the code will run through the actions one by one with each press of the button.  This has been successful but has come with a bug that I would like to change.  At the moment it I code for an action that is really long, like a minute or so, I have to wait for the action to be over before a button press will change to a new action.  What I want to do is write an interruption line that will allow the button the default to the next action at any pressing.  At the moment my code cycles through various LED temperatures of white and a few theatre scrolling patterns.  I am exploring more complex displays involving visualizations of Binary and Morse Code.  00000101.  dit dit dit dot dot.

I am going to be constructing the box to house everything this weekend or so.  I have to get that part done before it gets crazy with procrastinators in Battelle over the next few weeks.  Three weeks until the end of the year.

Wednesday
Apr132016

A Box With Light In It.

Over the past couple of weeks I have been toying with some experiments trying to figure out what I can create for a show in Acock Gallery.  It is a pretty tight space to 15 individuals so I am trying to downsize a little.  There are three ideas floating through my mind. The first is a doing something similar to my first two installations of the semester involving "Paper Clips" and "Shopping Carts".  This exploration would involve multiple shadows interacting with each other on a wall around a corner or some sort of interesting part of the room.

The second experiment involves a slowly pulsing spot light and a shadow that is suspended off the wall.  This object shadow is also painted the same as the wall.  My theory is that the light will pull the object from the wall as it pulses on and off.

The third experiment is an adventure with LEDs that will utilize the fiber optic quality of borosilicate.  So far I have constructed a box that holds glass rods.

Take the sketch with a grain of salt.  I don't imagine that it will be presented in this way.

There are a few interesting discoveries I made about glass rods and light.  Sandblasting a glass rod disrupts fiber optic quality. Fingerprints add to the luminous quality of the rod and do not detract from the fiber optic effect.  I have a few thoughts about how the light should exist in the work.  Mike Compton and I discussed how the light could encode information.  Binary code can be represented as light in pulses and in a sense can represent an image of something else in code form.  I would like to play with this translation of a objects to another form.

Thursday
Mar312016

Some Shadow Tests

I’ve been trying out a few experiments designed to explore the possibilities / could have beens among my last installation.  They are based on suggestions for the installation that arose from various critiques before spring break.

First is the pouring shadow.  This was a simple continuation of a shadow line until it became tangent to the adjacent zone of color.  It creates the illusion that the color zone is filling the shadow with color.

 

Second is the overlapping shadow.  In the test I simply allowed a shadow to extend into an adjacent zone and painted it accordingly. This allows the shadow to be free from the 1 to 1 relationship of the zone and shadow.  It creates a freeing effect.

The third experiment is a drop shadow of a shadow.  This experiment is an analogy / physical drop shadow for a painted shadow.  It lifts the painted shadow off the wall and creates the illusion that the shadow painting is an object itself hovering off of the wall.  I don’t believe this effect can survive as two shadows painted on the wall because I think it would reference a simple photoshop trick that would be cheesy or too simple.  The physical shadow tricks the eye into believing something exists that actually does not.