“Please Don’t Laugh When I Am Sleeping”

INSPIRATION

My suitemates would bring friends over to “study” at 3 AM. They would laugh, play music, and shout all the way to 5 AM when my roommate and I had 9 AM classes the next day. Therefore, I am creating an indicator that there is someone asleep in the room and the wall is paper-thin, even though they probably know that but chose to ignore the fact. Anyways, if this subtle hint doesn’t work, I will do something else.

IDEA

When the two aluminum foil touch, the boolean turns true, and green turns off and red turns on. On the other hand, when they part, the boolean turns false, and green turns on and red turns off.

BREADBOARD & ARDUINO BOARD

Photos

VIDEO DEMO

CODES

void setup() {
  // put your setup code here, to run once:
  pinMode(4, INPUT);
  pinMode(2, OUTPUT);
  pinMode(3, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  if (bool digitalRead(4) == HIGH) {   //pressed, if the two aluminum foils touch
    digitalWrite(3, HIGH);        //turns on red LED
    digitalWrite(2, LOW);         //turns off green LED
  }
  else {                          //released, if the two aluminum foils part
    digitalWrite (3, LOW);        //turns off red LED
    digitalWrite(2, HIGH);        //turns on green LED
  };
}

CHALLENGES

  1. Maybe it’s some problems with my codes. The green light turns on immediately when the two aluminum foils touch. However, it takes 5 to 7 seconds for the boolean flips, and then the red light turns on.
  2. Sometimes when the foil connected to the resistor and the ground gets in contact with something conductive, green turns off and red turns on, signifying that the boolean flips. This may be a problem with the circuit, but I am still figuring it out.

Leave a Reply