Thursday, February 7, 2013

Holy Crap! Success!!

I cant believe I did it!                 I will try to put up video of it sometime soon :)
my program is working in the elephant!  It may not be the most eloquent and a real programmer would think it is messy, but it works!
and the working code is....
drum roll please...


int rcheek = 9;
int rear = 5;
int lcheek = 10;
int lear = 11;
int aluminumFoil = A5;
int brightness = 0; //how bright the led is
int fadeAmount = 5; //how many points to fade the led by
int sensorValue;  //variable stores readings from the sensor

void setup() {
    pinMode(rear, OUTPUT);
pinMode(rcheek, OUTPUT);
pinMode(lcheek, OUTPUT);
pinMode(lear, OUTPUT);
  pinMode(aluminumFoil, INPUT); //sets aluminum foil pin to INPUT
  digitalWrite(aluminumFoil, HIGH); //initializes the sensor
  Serial.begin(9600); //initializes the communication
}

void loop() {
  sensorValue = analogRead(aluminumFoil);
  Serial.println(sensorValue);
  delay(100); //delay for 1/10 of a second

 if (sensorValue < 990 && sensorValue > 895) // if touching sensor
 {
  analogWrite(rcheek, brightness);  
analogWrite (lcheek, brightness);

  // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade:
  if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount ;

 }
 }
  else if (sensorValue <= 895 && sensorValue > 750)
  {  digitalWrite (rcheek, LOW);
  digitalWrite (lcheek, LOW);
  digitalWrite (rear, HIGH);
  digitalWrite (lear, HIGH);
  delay (200);
 
  digitalWrite(rear, LOW); //turn the LED off
    digitalWrite(lear, LOW); //turn the LED off
    delay (200);
}
  else if (sensorValue <= 750)
  {{
     analogWrite(rcheek, brightness);  
analogWrite (lcheek, brightness);
 // change the brightness for next time through the loop:
  brightness = brightness + fadeAmount;

  // reverse the direction of the fading at the ends of the fade:
  if (brightness == 0 || brightness == 255) {
    fadeAmount = -fadeAmount ;

 };
 {digitalWrite (rear, HIGH);
  digitalWrite (lear, HIGH);
  delay (200);
 
  digitalWrite(rear, LOW); //turn the LED off
    digitalWrite(lear, LOW); //turn the LED off
    delay (200);
 }}}
 else
 {
   digitalWrite (rear, LOW);
   digitalWrite (lear, LOW);
   digitalWrite (rcheek, LOW);
   digitalWrite (lcheek, LOW);
  }
  }

Wednesday, February 6, 2013

Welcome to my most recent headache...


why yes.... that is written code...
why no....i do not understand it....
why yes... i do have to keep writing it. I need help!

Thursday, January 31, 2013

Recent Art..

So these first two pictures are of my sculpture. I don't absolutely love it, but I worked hard on it.
This thing weighs a ton thanks to all my hair :-p



This is my elephant in progress. I have all of the lights working, but I haven't done all the programming .. I'm still learning how to do that.