Party Underwear

Did you ever wonder how to turn a casual night into a fun game? Here’s the solution..




 * Party Underwear

* by Andre Doria


* Turns on and off a light emitting diode(LED) connected to digital

* pin 13. The light is only turned on when the sensed ambient light

* is below a given number, obtained by analogRead() in pin 2 using

* a LDR


int sensPin = 2;    // input pin for the LDR

int ledPin = 13;   // output pin for LEDs

int ambientLight = 0;       // variable to store the value coming from the sensor

void setup() {

pinMode(ledPin, OUTPUT);  // declare the ledPin as an OUTPUT


void loop() {


ambientLight = analogRead(sensPin);    // read the value from the LDR sensor

if(ambientLight<380){                 // If its dark

digitalWrite(ledPin, HIGH);  // turn the ledPin on

}else{                           // If its bright

digitalWrite(ledPin, LOW);   // turn the ledPin off



Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s