Handless Switch : Sleep No More!

Description

Create an unusual switch that doesn’t require the use of your hands. Use Arduino digital input and output for the interaction.

Inspiration

Imagine you could identify all the listeners who sleep during your speaking sessions even if the listener sleeping is at the backbench. All you need is a LED that is positioned at a visible location and turns on immediately, a listener puts his or her head on the table.

Process

I started off by creating a simple circuit with an LED. I added a digital input pin on the Arduino and then, with code, I take the input and turn on the LED as a digital output. By bringing together the power pinned down by the resistor and the buttonPin, the LED turns on and when separated goes off. In order to bring the two together, I attached one to the forehead and the other to the table.

Final Work

Challenges

I wanted to attach one of the cables to my neck and the other one under my chin but it never worked so I decided to go with the idea above.

Code
const int ledPin = 2;
const int buttonPin = 3;


bool onOff = false;
bool prevButtonState = LOW;

void setup() {
   pinMode(ledPin, OUTPUT);
    pinMode(buttonPin, INPUT);

}

void loop() {
  
  bool currentState = digitalRead(buttonPin);
  
 if(currentState == HIGH){
      digitalWrite(ledPin, true);
    }

  else{
    
     digitalWrite(ledPin, false);
    }

     
   

}

 

Leave a Reply