Object Prototype 1

Im not sure if I read the assignment properly but I made the ciruit and I mounted it onto my object prototype already but I plan on cleaning it up and expanding more on the concept.

When I was doing the preliminary readings I was interested in the one artist Milton Komisar but I was having trouble finding documentation. What interested me was the experimentation with space but my other interest was culture and looking into cyberpunk culture. I've been wanting to approach the idea of eclipsing physical or cultivated identity (materialistic driven) with one Im able to construct out of my own abilities with a medium, a way of reclaiming an image that is formed from my perception rather than the one I am given. I think this works well coupled with experimentations of space and dimensions and use this to alter the face which is one of the things our sapient brains are built to interpret. It's rather goofy in its current state as the enlarged sockets gives the eyes a cartoonish emphasis when worn, I plan on changing this to imagery of an expanding singularity with a much larger array of LEDs and more space defining behaviour.


The circuit itself is hooked up to a joystick which Im using to alter the position and colour being emitted from the pixel strip. The Joystick can also be pressed in an used as a button which I am using to switch between the different LED modes I've set up.


#include 
#ifdef __AVR__
#include 
#endif
#define PIN 4 //pin neopixels are on
#define NUMPIXELS 8 //pixels in the strip array

//number of pixels, pin#, type of pixel
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int potRead = 0; //potentiometer analog pin

int xPin = 1; //x analog pin
int yPin = 2; //y analog pin
float readX; //x value
float readY; //y value

int tButton = 3; //Analog pin for button
bool tPress; //button input
bool tCheck; //only use input once
int modeMax = 2; //numper of Cases for LED modes
int LEDmode; //current LED Case
//a input timer to stop incorrect joybutton inputs when operatin joystick axis
int pushHold;
int pushTime = 10;

//
int jSliderMove; //Current pin position of slider
int jMove;
int jBounce = 1;
int jTime = 500;
//
int type1 = 1;
float seconds;
long timer = 100;

void setup() {
  //setup Serial and pixels
  Serial.begin(9600);
  pixels.begin();
  //setup pot pin
  pinMode(potRead, INPUT);
  //JoyStick
  pinMode(xPin, INPUT);
  pinMode(yPin, INPUT);
  pinMode(tButton, INPUT);
}

void loop() {
  //JoyStick Control
  readX = analogRead(xPin);
  readY = analogRead(yPin);

  //Joystick Press
  if (analogRead(tButton) < 1)
  {
    tPress = true;
  } else
  {
    tPress = false;
    tCheck = true;
    pushHold = 0;
  }

  //change LED mode on joystick press
  if (tPress && tCheck)
  {
    //require button to be pressed down to avoid false feedback from
    //moving the joystick axis
    pushHold++;
    if (pushHold >= pushTime)
    {
      //LED mode up
      LEDmode++;
      //switch off press once check
      tCheck = false;
    }
  }
  //cycle mode back to start when past end
  if (LEDmode > modeMax)
  {
    LEDmode = 0;
  }

  //switch for LED modes
  switch (LEDmode)
  {
    case 0:
      joySlider();
      break;
    case 1:
      twoStep();
      break;
    case 2:
      ripple();
      break;
  }
  pixels.show();

  //Serial.print(readX);
  //Serial.print(" | ");
  //Serial.print(readY);
  //Serial.print(" | ");
  //Serial.println(tPress);
  Serial.println(readX);

  //Serial.println(potVal);
  /*
    for(int a = 0; a < NUMPIXELS; a++)
    {
    pixels.setPixelColor(a, pixels.Color(50,5*a,0));
    }
    pixels.show();
  */
  //Serial.println(potVal);
}

//increases pixels on by potentiometer
//Not currently being used.
void slider()
{
  int potVal = analogRead(potRead);
  int potVal2 = map(potVal, 0, 1020, 0, NUMPIXELS);

  for (int a = 0; a < NUMPIXELS; a++)
  {
    if (a <= potVal2)
    {
      pixels.setPixelColor(a, pixels.Color(map(a, 0, potVal2, 10, 50), 1, map(a, 0, potVal2, 1, 5)));
    } else
    {
      pixels.setPixelColor(a, pixels.Color(0, 0, 0));
    }
  }
}

//bounces a patch of pixels back and forth
void joySlider()
{
  //move the slider and adjust speed to slider
  jMove += map(readY, 0, 1023, 3, 15) * jBounce;
  //map pins on on to slider
  jSliderMove = map(jMove, 0, jTime, 0, NUMPIXELS);
  
  //reverse the direction when slider is past max/min pixels
  if (jSliderMove > NUMPIXELS)
  {
    jBounce = -1;
  }
  if (jSliderMove < 0)
  {
    jMove += (jTime*2)/NUMPIXELS;
    jBounce = 1;
  }

  for (int a = 0; a < NUMPIXELS; a++)
  {
    pixels.setPixelColor(a, pixels.Color(10, 20, 10));
    //
    //pixels.setPixelColor(a, pixels.Color(map(a, 0, potVal2, 10, 50), 1, map(a, 0, potVal2, 1, 5)));
  }
  //set patch of pixels on dependent on where the timer is between 0 and max
  pixels.setPixelColor(jSliderMove-1, pixels.Color(100,20,0));
  pixels.setPixelColor(jSliderMove, pixels.Color(200,20,0));
  pixels.setPixelColor(jSliderMove+1, pixels.Color(100,20,0));
}

//alternate pixels on or of
void twoStep()
{
  //Serial.println(seconds);

  //speed of alternating timer changes based on moving the Joystick x axis
  seconds += map(readX, 10, 1023, float(0), float(5));
  //whenever the timer finishes alternate the LEDs through type1 and reset timer
  if (seconds >= timer)
  {
    if (type1 == 0)
    {
      type1 = 1;
    } else
    {
      type1 = 0;
    }
    seconds = 0;
  }

  //type1 variable is set to either 1 or 0 so that it offsets which pixels pass as even
  //alternating between even or odd pixels turning on.
  for (int a = 0; a < NUMPIXELS; a ++)
  {
    //if Even
    if ((a + type1) % 2 == 0)
    {
      //set
      pixels.setPixelColor(a, pixels.Color(50 + map(readY, 0, 1023, 0, 200), 0, 10 + map(readY, 0, 1023, 0, 200)));
    }
    //if Odd
    else
    {
      //pixels off
      pixels.setPixelColor(a, pixels.Color(15, 5, 0));
    }
  }
}

//move pixels on by the direction of joystick axis
void ripple()
{
  for (int a = 0; a < NUMPIXELS; a++)
  {
    //set pixels default low Red
    pixels.setPixelColor(a, pixels.Color(20, 0, 10)); 
  }
  //set patch of pixels on dependent on position of joystick X axis
  int xPos = map(readX, 0, 1023, 0, NUMPIXELS - 1);
  int yPos = map(readY, 0, 1023, 50, 250);
    pixels.setPixelColor(xPos + 2, pixels.Color(10, 50, yPos));
    pixels.setPixelColor(xPos + 1, pixels.Color(10, 200, yPos));
    pixels.setPixelColor(xPos, pixels.Color(10, 200, yPos));
    pixels.setPixelColor(xPos - 1, pixels.Color(10, 50, yPos));
}



Comments