Announcements

November 24, 2007
Reading for November 27th, are now posted. Enjoy!

October 2, 2007
To upload your thoughtless acts, create a new assignment page like any other lab. You'll see "Thoughtless Acts" listed as one of the assignment options.

May 24, 2008
This site has been archived and is no longer editable. Stay tuned for the next version, coming in the fall!


Revision of Firefly from Mon, 10/08/2007 - 18:35

Project Members: 
Laura Greig

Description

A firefly that lights up when you cup your hands around him.

Components

  • Clay body
  • Tiny green LED
  • 220Ohm resistor
  • Photo resistor

Arduino Code

int ledPin = 10;
int photoPin = 0;

void setup()
{
  pinMode(ledPin, OUTPUT);      // sets the digital pin as output  
  pinMode(photoPin, INPUT);
    Serial.begin(9600);
}

void loop()
{
  int light = analogRead(photoPin);
Serial.println(light);

delay(10);
  for(int i=0; i<255; i++){
  analogWrite(ledPin, i);
 // Serial.println(i);
  }
  for(int i=255; i>0; i--){
      analogWrite(ledPin, i);
  }
}


Powered by Drupal - Design by Artinet