Switching It Off – Securing the Butt Pocket Part 2

Continuing from the first part of the pocket switch, this new part incorporates a a watch. Basically, the user now has the option to turn off the motor and lit LED that activate when the phone/wallet is removed. With the power of the switch, the user can turn it to the “Off” setting to turn off the LED and motor. Once the phone/wallet is back in the pocket, the switch can be flipped back to reset the security.

 

And here is the source code:

void setup()
{
   Serial.begin(19200);
  pinMode(7,OUTPUT);
pinMode(8, INPUT);
pinMode(10, INPUT);
}

void loop()
{
    if (digitalRead(8) == HIGH){
      if (digitalRead(10) == HIGH){
      digitalWrite(7, LOW);
      }    
      else{
       Serial.print("AA");
       digitalWrite(7,HIGH);
       }
    }
   else{
   digitalWrite(7, LOW); 
  }
}

 

Arduino Code
My source code

 

 

Leave a Reply