Brendon Walter Final Project

From BenningtonWiki
Jump to: navigation, search

Wiki home

First idea (NO LONGER BEING DONE!)

Brain Storming

The point that I wrote down on this sheet of paper in class that I liked the most was the idea of something running away from you when you approach it, and something that only moves when it thinks nobody is in the room.

Inspirations

Video of a cat stalking a person

What I like about this video is that it seems like the cat isn't even moving, it seems to just teleport closer and closer to the person. When the person makes a movement towards the cat at the end, it runs away - all that work for nothing!

Alarm clock that runs away from you

Similar to the cat running away in the previous video, this alarm clock runs away from you when it goes off, making you run after it to turn it off. I'm not too sure I like the idea of making people run after my device, but I do like the idea of it running away.

Perhaps it can try to sneak up on you like the cat, then run away and try to dodge your grasp like the clock.

I also like the idea of some grumpy / adorable little thing sitting there being grumpy / adorable.

Roomba

This is a vacuum cleaner that moves around a room and when it bumps into an object, it changes directions. The enclosed area it works in can either be defined by objects making a wall, or a laser that when crossed, makes it change directions as if it bumped into a physical object.

I can't find a link for it, but I also liked the project we looked at in class of the table that chooses one person in a room and then follows them around.

Arduino Controlled Servo Robot (SERB)

Guide for making an arduino controlled robot

Proposal

I would like to make an object that would seem to be 'shy.' It would only move when the room is empty (or more likely / possible, when it doesn't detect any quick movements). When no movement is detected, it would move freely about the room. Once movement is detected, it will freeze. If it detects that the movement is fast, moving towards it, or otherwise 'scary' / threatening, it would run away, perhaps even find a place to hide under. If somebody wants to capture it or hold it, they would either have to move very quickly and 'surprise' it (moving before it has time to react, or move faster than it can move) or move very slowly as to not 'scare' it.

No / little movement - wander around freely

Movement - stop. Don't move until the movement stops

Quick movement / movement towards it - run away!

No / little noise - chirp or just make happy noises

Loud noise - freeze!

Very loud noise - hide / run away!

Features

Motion detector - to detect movement and analyze it to determine if it's a threat or not (a threat would be determined by something moving quickly and / or towards it)

Sound detector - to run away / hide from loud noises

Wheels or other mode of moving - so it can move around the area

Bump / touch detector - so it can change directions if it runs into a wall or other object


Optional:

Sound maker - so it can wail (or something) when touched

would make it so people can interact with it more. People are going to want to try and catch it

but could I get it to work so that it wails only when people touch it, and not whenever it bumps into an object in the room...


Remote control - to power it off in case it's too hard to catch

Proposal to the Class

Most people don't think of robots as having personalities, unless they are a high-tech robot from a movie, such as C3-PO. For this reason, I would like to make a robot that is "shy" and draws people towards it so that they feel encouraged to try to interact with it as they would a small cat or dog.

In order to make it seem shy, it will have certain traits that are thought of as being shy traits. These include: Hiding from people, trying to make itself small and unseen, trying not to call attention to itself, and it could even whimper when humans are near it. It would either freeze or runaway from loud noises or fast movements, depending on how fast or loud the movement or sound is.

In order to make people want to interact with it, it has to be intriguing in some way. I decided that the best way to get people to want to approach it and try to touch it would be by making it cute looking.I thought about what makes something cute and a friend of mine and I decided that what makes something cute is if it's small, in need of protection, soft/fluffy/fuzzy, cuddly looking, and big eyes.

The design is based off of SERB, and arduino controlled robot. SERB is straight forward, easy to make, and the first words out of my friend's mouth when he saw a picture of it on my screen was, "Huh... it's pretty cute." However, it is very box like and the openness of the wires make it technical and less friendly looking - less approachable.

The main point of the design that I liked the most were the big wheels. Putting eyes, especially big ones, onto a robot would quickly take a trip down uncanny valley so instead of using big eyes, would big wheels serve the same purpose?

As can be seen in the pictures above, I was trying to change the design to not only make it my own, but make it so it could be more cute in appearance. The two big wheels are powered by servo motors and the front wheel serves as a supporting wheel so it doesn't tip around. On the front of it are whisker wires that would be used just as whiskers are used on a cat - to know how big a space is and if the cat can enter it. These whiskers would make it so that when the robot hides under something, it doesn't get suck in a space that is too small for it. It also makes it so it can react to people touching it.

Each drawing above are different versions and shapes that the robot could take. My favourite, and most likely the final version, is the final drawing on the second page

Contrary to what was said earlier about what makes something cute, I will not be making this fuzzy or fluffy in anyway as I don't see a way that it can be done without looking tacky. I believe that the best material for this would be acrylic for a variety of reasons. As we saw in the wood shop with John Umphlett, acrylic can be easily bent when exposed to heat. Also, it is congruent to the idea that robots can have personality and can be cute. To make a robot that looks just like a cat or a mouse would make it approachable in that people would go up to it with the expectations that it would act like a cat or a mouse, or any other cute animal that it would resemble. Allowing the body to be see through, however, would make those expectations go away and would introduce the challenge of if it's possible to make people find something with exposed wires cute.

The main difference between the way that I would like to do the acrylic and the way that it was done in SERB is that with SERB, no part is fully covered. The wires, batteries, breadboard, and arduino are all exposed to the air. Completely covering the body in acrylic like I would like to do makes it so that while each part is visible, people will not be afraid of touching it out of fear that the they might loosen wires or break it in some other way.

Finally, I would like to put a small screen that would convey emotion in the form of emoticons:

:D - "This is fun!" - used when there is no movement and little noise
:) - "This is okay..." - little movement, little noise
:( - "I'm not so sure about this" - movement and/or noise
D: - "ohgodohgodohgod" - quick movement and/or loud noise
D:< - "Don't touch me!" - when whiskers are touched
:3 - "omigosh, aren't I cute???" - human properly interacting with it
o.O - "I'm confused by what's happening..." - other, or otherwise confusing scenario.

The event to make the :3 emoticon would be a person slowly walking up to it and non threateningly approaching it. This will be the most difficult to program, as it would be determined by quickness of movement and amount of sound being made.

To Do

Spreadsheet


Second Idea (CURRENT, WORKING IDEA)

Description

I decided to scrap my original idea for the final project. I did not have any attachment to it, and I felt that it was seriously lacking in certain areas. I emailed Robert to see if I could change my final, and luckily, I could.

For my new idea, I got to thinking back to the brainstorming we did in class and this time, I focused on the idea of walking into a room and triggering a large event. Instead of walking into a room, however, my mind went to setting up a piece in the hallway outside of the pod where some of the senior and junior work tends to go. When the artwork isn't there, the hallway is blank, white, plain, and boring. Originally, I thought of having strings of LEDs that track movement through the hallway, each string (or individual LED) lighting up as the person passes in front of it, and off again when the person moves away from it. This idea, I thought, didn't go anywhere. There was no, or little, purpose to it and it wouldn't offer much as a piece of art.

In figuring out how to make it more enjoyable, I thought of incorporating sound into it. Thinking of the piano staircase that was put into a subway station, I thought of putting down squares that when stepped on would make a musical note. The LEDs on the way would then reflect the sound, moving at a faster or slower pace, going in different directions, and could even make patterns on the wall.

The way the wall is divided up, there are two sections about equal in length. There is a dip in the wall in the center for a support beam which cuts across the ceiling and another beam breaks up the wall on the other side of the hallway. It was in this center part that I was thinking of putting the sound squares that would be pressure activated. Five or so squares would line from wall to wall under the support beam and would be arranged by pitch so people could make short musical pieces if they so chose.

The string of LEDs would go from one end of the wall to the other and would start off by tracking the movement of the person. When the person then steps on the squares in the middle, light will shoot out in each direction and will resume following their position when they continuing waking out of the piece.

I think it's important to ask why? at this juncture. Why are you making this work/creating this experience? Good examples below of some similar projects--how do you enter a dialogue with those works and extend some of the original maker's thinking, ideas etc. towards your own concerns and interests? Robert_Ransick 15:10, 30 April 2013 (UTC)
The work I mentioned in class from the Indianapolis Airport Project Website and videoGhenderson 06:16, 1 May 2013 (UTC)

More Edited Idea

Talking to Robert gave me ideas to evolve this idea so that I could answer the question 'why?' more clearly. While talking, and thinking about how to expand this project to make it better, I decided to bring the personality from the previous project back into this one. The question is, how can you give a hallway a personality? Perhaps more importantly, why the hallway?

I chose the hallway because hallways are a space to walk through to get from one destination to another and while there is art that sometimes hangs up in the hall, it isn't there year round and the only times I have seen art up on this wall was during senior and junior reviews. When those pieces were up, I saw a number of people looking at the art on the wall as they walked through, and a number of other people who stopped to look at the art and even some who would have discussions inspired by the art.

When the art isn't there, it remains bland and boring, and there is nothing to inspire conversations or to make people stop and look around. It can be said that rooms have personality, inspired by the function of the room and the objects in it, and it could be said that that hallway has a personality as well, but not much of one. I thought about if I could give it a personality, personify it, by putting something on one of the walls.

I am also found of the idea of not really being able to see a piece, that is, it changes based on where it is viewed from. One way to do this would to have the art on the wall move, even hide, from people coming to close to it, as the bot from the previous project would have done.

This is the idea: There would be flower-like shapes on the wall made out of LEDs. When nobody is in front of it, the 'flowers' would be in full bloom, proudly waving, perhaps in an imaginary wind. When somebody walks through the hall as they are bound to do, the LEDs that make up the 'flowers' turn off in quick succession one by one giving the appearance of shrinking into the ground, until there is only one LED on at the very bottom. Once the person walks through, past the wall, the LEDs slowly resume full bloom.

Perhaps this was discussed in class last week, but I am curious about why one LED will be left on when someone walk by, and why do they shrink away rather than bloom when someone walks by? -Caseysimone
This was actually something I was thinking about changing since we presented our ideas last class. The original idea was that people would see the wall lit up from a little while away when walking down the hall and would approach it to see what pattern the LEDs draw out. Most art can be viewed from any angle and I liked the idea of playing on this, by making it so that you could only really see the piece from an impractical angle (as in, from either side rather than in front).
However, to me, and it sounds like maybe for you, it would make more sense to have it bloom instead of wither. This way, it would almost be almost unseen (at least to someone not paying attention while walking down the hall) until they are right in front of it. This way, it would have the element of surprise more so than the other way.
The idea with the one LED at the bottom (that I guess I didn't finish my though process when I was explaining that...) would be that it would almost be as if the objects would pool at the bottom of the wall, as if they melted.--Brendon

Yet another update

In class, I described the shapes that would be on the wall as being flower like and used similar terminology to refer to them, as in, the would 'bloom' and 'wither.' However, 'flower' is not really the right word to describe them, though the shapes certainly would be floral in nature. I tend to draw out patterns that are heavily inspired by flowers and tend to take on similar shapes. Some examples shown below:

My intention is that the shapes drawn out on the wall would look somewhat similar to these, more like the third picture than the rest. However, they will be more spaced out than they are in any of these pictures because if compacted together like this, I worry that they will bleed into each too much and their shapes will be lost. Keeping within tradition as to how I draw these, I do not have a direct plan for how it will look. I have found through years of drawing these that plans that are made are changed as quickly as they are made and the best work comes out through improvisation.

As said above in reply to Caseysimone's comment, after we talked about our projects in class last week I started thinking about reversing it, so that the floral shapes would 'bloom' rather than melt when people walk by. The other way, people may think, "well, what was the point of that?" and continue walking to their destination without giving it much thought. Having them bloom, I think, will make it more surprising, especially if the LEDs are hidden on the wall in some way (behind a skrim or something similar.)

Also talked about last class was how placing the LEDs on the wall would make it seem less like the wall was alive and more like it is used as a canvas. One idea was put out in class of a way to make the wall seem alive in a way would be by placing a sheet over the wall that would be almost unnoticeable until it almost starts reaching out towards people as they walk by.

Using a screen/sheet in front of the LEDs would take careful planning on how to make it seem like the wall is alive which I'm not too sure the projects needs. However, the sheet would provide unique results - The LEDs can be hidden until someone walks by them, making their presence more surprising and less foreseen. In addition, the sheet can hid the wires and soldering keeping the LEDs together.

Inspirations

Piano Staircase

People in Sweden turned a staircase going into a subway station into a piano to see if they could get more people to use the stairs instead of the escalator. According to their video, 66% more people used the stairs than they did before. I would like to use a similar idea with the pressure plates for my project.

Christmas Lights

Christmas lights on a house were programmed to light up in sync with a song by the Trans-Siberian Orchestra.

Connection by Electroland

Thanks, Glennis, for this!

To Do / Timesheet

Google doc

Progress

Week 1

Notes on each step can be seen in the timesheet linked above!

One of the questions that arose for me in how to make this was what I was going to use for the lights. I had several options: LED tape, which is rather expensive, Christmas lights, which I felt didn't match the idea I had for the project, or stringing a whole bunch of LEDs together, which also had several problems, mostly that it would take a very long time. However, the process does have its benefits: it is easy to choose whichever color I want, as well as switch out colors at will. I can choose the spacing of each light, decide exactly how long each strand will be, and it had complete control of customization. An rough example of how it will be made is shown below.

The wire I used in this example was thicker than it had to be for the task and the coating was a pain to take off because of its thickness. The wire I am planning on using for the final project will be much more thin, more right for the job, and will speed up the process significantly.

Week 2

I got a SHARP GP2D12 IR sensor from Tim after class and have started to play around with it. According to this site, this is how it works:

Theory of Operation
With the introduction of the GP2DXX line of Sharp detectors, a new approach was developed that not only gives object detection at a longer range than the previous method, but also offers range information, in the case of the GP2D12, GP2D120, and GP2DY0A ('0A') detectors. These new rangers offer much better immunity to ambient lighting conditions because of the new method of ranging.
These new rangers all use triangulation and a small linear CCD array to compute the distance and/or presence of objects in the field of view. The basic idea is this: a pulse of IR light is emitted by the emitter. This light travels out in the field of view and either hits an object or just keeps on going. In the case of no object, the light is never reflected and the reading shows no object. If the light reflects off an object, it returns to the detector and creates a triangle between the point of reflection, the emitter, and the detector.
The angles in this triangle vary based on the distance to the object. The receiver portion of these new detectors is actually a precision lens that transmits the reflected light onto various portions of the enclosed linear CCD array based on the angle of the triangle described above. The CCD array can then determine what angle the reflected light came back at and therefore, it can calculate the distance to the object.
This new method of ranging is almost immune to interference from ambient light and offers amazing indifference to the color of object being detected. Detecting a black wall in full sunlight is now possible.


I used this code to start to play around with it:

//This is a test code to see if I can get my SHARP IR sensor working
//This code (for the most part) was taken from:
//http://communityofrobots.com/tutorial/kawal/how-use-sharp-ir-sensor-arduino


int sensorPin = 0;    //connected to anologue pin 0
int val = 0;                //variable to store valuables from the sensor

void setup() {
   Serial.begin(9600);    //start the serial monitor
}

void loop() {
   val = analogRead(sensorPin);   //reads the value from the SHARP sensor
   Serial.println(val);           //prints the value from the sensor to the serial monitor
   delay(100);                    //delay before printing next value
}

I was able to get numbers to display in the serial monitor.

I'm currently trying to get it to light up an LED.

//This makes the LED turn on when the sensor is exposed to light, and
//off when the light is blocked.

const int LED = 2;
const int SENSOR = A0;

int val = 0;
int val2 = 0;

void setup() {
 pinMode(LED, OUTPUT); 
 Serial.begin(9600);
}

void loop() {
 val = analogRead(SENSOR); //read value from sensor 
 analogWrite(LED, val/2); //turn the LED on at the brightness set
                          //by the sensor
 //val2 = analogRead(SENSOR);
 Serial.println(val);
 delay(10);
}

The above code will make the LED turn on when there is an object in front of it. I can change what number val is divided by to change how far away an object can be and still be detected. When it is val/4, it only turns on the LED for objects that are within half a foot. With val/2, it works with objects much further away. I still have to tweak it to find what the magic number is in order to work in the hallway.

Week 3

I talked to Tim about trying out an RGB LED to see if I should use it in my project, due to the suggestions that I should make the strand change color throughout the day depending on the time. I got it working with a code I got from online to change the colors (no picture...) The tutorial I used is here.

After making it work and decided that I would like to use those in my project, I figured that it might be easier to make my project using RGB LED tape as it would be less costly and less time consuming than stringing up a whole number of individual LEDs together. I sent an email off to Tim and Robert and Tim already had some on hand. The tape is this one from addafruit. The site includes a tutorial on how to use it.

In order to use it, one has to download a library called LPD8806 and it includes an example that shows off what the LED strip can do. I only have a strip of two for now (thank you, Tim!), but it still works to see what it can do.

As Tim said, the code for using this is rather confusing, but I've been working my way through the example code to make it do what I want. I've been taking code in parts from the sample code and putting it together into another document one by one to understand each one fully and so I can add my own comments explaining them. Here is what I have:

#include "LPD8806.h"
#include "SPI.h"

// Number of LEDs in the strand
int nLEDs = 2;

// Digital output pins
int dataPin = 3;
int clockPin = 2;

LPD8806 strip = LPD8806(nLEDs, dataPin, clockPin);

void setup() {
  // Start up the LED strip
   strip.begin();
  
  // Update the strip, to start they are all 'off'
   strip.show(); 
}

// Main function that calls all the others. 
// It's where all the magic happens.
void loop() {

  colorChase(strip.Color(0,   0, 127), 1000); // Violet
}

// Color wipe makes each light light up in sequence, switching
// between each color called. (one color will make it one color
// all the way through)
// Call method looks like:
// colorWipe(strip.Color(r, g, b), time);
// ex. colorWipe(strip.Color(127, 0, 0, 1000); // Red
void colorWipe(uint32_t c, uint8_t wait) {
  int i;

  for (i=0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, c);
      strip.show();
      delay(wait);
  }
}

//Lights up in sequence. As if they're chasing each other. (hence the name...)
void colorChase(uint32_t c, uint8_t wait) {
  int i;

  // Start by turning all pixels off:
  for(i=0; i<strip.numPixels(); i++) strip.setPixelColor(i, 0);

  // Then display one pixel at a time:
  for(i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c); // Set new pixel 'on'
    strip.show();              // Refresh LED states
    strip.setPixelColor(i, 0); // Erase pixel, but don't refresh!
    delay(wait);
  }

  strip.show(); // Refresh to turn off last pixel
}

// Makes the LEDs fade from color to color together
// it would be called like so: 
// rainbow(10);
// the larger the number, the longer it takes to cycle through
void rainbow(uint8_t wait) {
  int i, j;
   
  for (j=0; j < 384; j++) {     // 3 cycles of all 384 colors in the wheel
    for (i=0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel( (i + j) % 384));
    }  
    strip.show();   // write all the pixels out
    delay(wait);
  }
}

// Same as rainbow but each light loops seperately rather than
// together. It is called like so:
// rainbowCycle(10); // the higher the number, the slower it goes
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;
  
  for (j=0; j < 384 * 5; j++) {     // 5 cycles of all 384 colors in the wheel
    for (i=0; i < strip.numPixels(); i++) {
      // tricky math! we use each pixel as a fraction of the full 384-color wheel
      // (thats the i / strip.numPixels() part)
      // Then add in j which makes the colors go around per pixel
      // the % 384 is to make the wheel cycle around
      strip.setPixelColor(i, Wheel( ((i * 384 / strip.numPixels()) + j) % 384) );
    }  
    strip.show();   // write all the pixels out
    delay(wait);
  }
}

// as far as I can tell, rainbow needs this because it calls
// on the function 'wheel'. 
uint32_t Wheel(uint16_t WheelPos)
{
  byte r, g, b;
  switch(WheelPos / 128)
  {
    case 0:
      r = 127 - WheelPos % 128;   //Red down
      g = WheelPos % 128;      // Green up
      b = 0;                  //blue off
      break; 
    case 1:
      g = 127 - WheelPos % 128;  //green down
      b = WheelPos % 128;      //blue up
      r = 0;                  //red off
      break; 
    case 2:
      b = 127 - WheelPos % 128;  //blue down 
      r = WheelPos % 128;      //red up
      g = 0;                  //green off
      break; 
  }
  return(strip.Color(r,g,b));
}

I have a code that MIGHT work to make the LEDs light up to give the shapes the appearance of blooming. But because I only have two LEDs, I don't know if it will work. It was taken from the colorChase example in the previous code where I commented out lines to make it do what I want (hopefully). Currently, the first one stays on and the second one rapidly blinks. Hopefully it will work with a longer strand...

The code:

#include "LPD8806.h"
#include "SPI.h"

// num LEDs in strand
int nLEDs = 2;

// digital output pins
int dataPin = 3;
int clockPin = 2;

LPD8806 strip = LPD8806(nLEDs, dataPin, clockPin);

void setup() {
  // start LED strip
  strip.begin();
  strip.show(); 
}

void loop() {
  rise(strip.Color(127, 0, 0), 50); // red
}

void rise(uint32_t c, uint8_t wait) {
  int i;

  // Start by turning all pixels off:
  for(i=0; i<strip.numPixels(); i++) strip.setPixelColor(i, 0);

  // Then display one pixel at a time:
  for(i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c); // Set new pixel 'on'
    strip.show();              // Refresh LED states
    delay(wait);
  }
}


Week 4

I did not get as much done this week as I would have liked as I had two finals due yesterday. However, I did make some progress, and my LED strips (3 meters) came in this week. I've been working to get the lights to turn on one by one going up the strand until it gets to the last LED, then it stops. Currently, the code I edited last week that I wasn't sure would work works to turn on each LED in sequence, but once it gets to the last one, it starts over.

#include "LPD8806.h"
#include "SPI.h"

// num LEDs in strand
int nLEDs = 32;

// digital output pins
int dataPin = 3;
int clockPin = 2;

LPD8806 strip = LPD8806(nLEDs, dataPin, clockPin);

void setup() {
  // start LED strip
  strip.begin();
  strip.show(); 
}

int main() {
  int j;
  for (j = 0; j < strip.numPixels(); j = j + 1) {
    rise((0, 0, 127), 400); 
  }
  return(0);
}

void rise(uint32_t c, uint8_t wait) {
  int i;

  // Start by turning all pixels off:
  for(i=0; i<strip.numPixels(); i++) strip.setPixelColor(i, 0);

  // Then display one pixel at a time:
  for(i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c); // Set new pixel 'on'
    strip.show();              // Refresh LED states
    //strip.setPixelColor(i, 0); // Erase pixel, but don't refresh!
    delay(wait);
  }

  strip.show(); // Refresh to turn off last pixel
}

The above code does not work, but it's one of my many attempts to make it stop repeating itself.

I've been pulling my hair out trying to figure out why it won't work, but on the plus side, I'm learning more about how to write and call functions (as well as for loops) in c...

I have also made a frame in which the LEDs will be place in. The fabric covering the top (and making it look nice) should be arriving here on campus either Wednesday or Thursday. As it is now, I have a wooden frame that is divided into three sections (for each of the LED figures) and a cardboard backing where I can stick pins into to form the shapes I want. Pictures will be up soon.

Week 5

It isn't working and I don't know why :( To correct that, two of the three strands are working and the third is wired up correctly but will not turn on.

I got some foam core from Robert and I cut it down to make a new backing for the frame. People said in class to refrain from dividing the frame into three parts (which was originally done for support) and now with the foam core, that was possible. At the base of the foam I cut out a small rectangle for the breadboard and Arduino where it now sits. Each strand of LEDs plugs into the breadboard, though as I said, one of them doesn't work even though it's plugged in correctly. Until this one works, I don't want to stretch the sheet over it as that will make troubleshooting that strand impossible.

What is strange is that after getting all of the strands, I tested each one and each one worked. I didn't do anything rough with it, didn't crush it in anyway, I kept it inside the box with all the other strands.

Video

Here's the code:

#include "LPD8806.h"
#include "SPI.h"

// num LEDs in strand
int nLEDs = 32;

// digital output pins
int IRpin = A3;
int clockPin = 2;
int dataPin = 3;

LPD8806 strip = LPD8806(nLEDs, dataPin, clockPin);

void setup() {
  Serial.begin(9600); 
  strip.begin();
  strip.show();
}

void loop() {
  
  // This calculates the distance in cm
  float volts = analogRead(IRpin)*0.0048828125;
  float distance = 65*pow(volts, -1.10);
  Serial.println(distance);
  
  // If there is something closer than 40 cm
  if (distance < 30) {
    // turn LED on
    rise((0, 0, 127), 400);
    delay(5000);
    rainbow(100);
    fall((0,0,0), 400);
    
  } 
  else {
    // Otherwise, turn it off.
    off();
  }
  
  delay (100);
}

void rise(uint32_t c, uint8_t wait) {
  int i;

  // Then display one pixel at a time:
  for(i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c); // Set new pixel 'on'
    strip.show();              // Refresh LED states
    //strip.setPixelColor(i, 0); // Erase pixel, but don't refresh!
    delay(wait);
  }

  strip.show(); // Refresh to turn off last pixel
}

void fall(uint32_t c, uint8_t wait) {
  int i;

  // Then display one pixel at a time:
  for(i= 0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, 0); // Set new pixel 'on'
    strip.show();              // Refresh LED states
    //strip.setPixelColor(i, 0); // Erase pixel, but don't refresh!
    delay(wait);
  }

  strip.show(); // Refresh to turn off last pixel
}

void off() {
  int i;
  // Turn each LED off
  for(i=0; i<strip.numPixels(); i++) strip.setPixelColor(i, 0);
  strip.show();
}

void rainbow(uint8_t wait) {
  int i, j;
   
  for (j=0; j < 384; j++) {     // 3 cycles of all 384 colors in the wheel
    for (i=0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel( (i + j) % 384));
    }  
    strip.show();   // write all the pixels out
    delay(wait);
  }
}

uint32_t Wheel(uint16_t WheelPos)
{
  byte r, g, b;
  switch(WheelPos / 128)
  {
    case 2:
      r = 127 - WheelPos % 128;   //Red down
      g = WheelPos % 128;      // Green up
      b = 0;                  //blue off
      break; 
    case 1:
      g = 127 - WheelPos % 128;  //green down
      b = WheelPos % 128;      //blue up
      r = 0;                  //red off
      break; 
    case 0:
      b = 127 - WheelPos % 128;  //blue down 
      r = WheelPos % 128;      //red up
      g = 0;                  //green off
      break; 
  }
  return(strip.Color(r,g,b));
}

And the moment I changed the color of the LEDs, the rise function stopped working. I don't know why, literally all I did was change one input value in the called function. I did not even touch the original one.