Week 7— Octopus:

Octopus: 

For this project I wanted to learn how to use the laser cutter to make a creature. My original plan was to use wood, a PIR sensor, wave shield and 5 LEDS. Due the time constraint I ended up just working on the LEDS and getting the correct fade that I desired.

Steps CODE:

1) Basic code testing fade function with one LED

2) Code at 50% Duty Cycle which is equal to 127 with 2 LEDS and delay of 10 milliseconds.

3) For the final code instead of trying to cross fade the leds i decided to use a for loop to fade them all at once.

 

Result:

 

Link to Film: 

IMG_0264

 

IMG_0263

 CODE: 

int ledPin = 9;    // LED connected to digital pin 9
int ledPin2 = 10;
int ledPin3 = 6;
int ledPin4 =11;
int ledPin5 = 3;
void setup()  {
  // nothing happens in setup
}
void loop()  {
  // fade in from min to max in increments of 5 points for loop :
  for(int fadeValue = 1 ; fadeValue <= 255; fadeValue +=5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledPin, fadeValue);
analogWrite(ledPin2, fadeValue);
analogWrite(ledPin3, fadeValue);
analogWrite(ledPin4, fadeValue);
analogWrite(ledPin5, fadeValue);
    // wait for 30 milliseconds to see the dimming effect
    delay(30);
  }
  // fade out from max to min in increments of 5 points:
  for(int fadeValue = 255 ; fadeValue >= 1; fadeValue -=5) {
    // sets the value (range from 0 to 255):
    analogWrite(ledPin, fadeValue);
analogWrite(ledPin2, fadeValue);
analogWrite(ledPin3, fadeValue);
analogWrite(ledPin4, fadeValue);
analogWrite(ledPin5, fadeValue);
    // wait for 30 milliseconds to see the dimming effect
    delay(500 );
  }
}