Introduction: The Hidden Socket Safe

-------------------------------------------------- - - - - - -編碼 - - - - - - - - - - - - - - - - - - - ---------------------------------------

我的代碼的網站:

https://create.arduino.cc/editor/ethan129/15a29b88 ...

編碼 :

#包括

int btn = A0; //隱藏的按鈕別針

布爾狀態=假; //鎖定,對於打開則為true

int lkrpin = 2; //鎖定伺服電機數據引腳

伺服儲物櫃

void setup(){//默認設置

locker.attach(lkrpin);

pinMode(btn,INPUT);

move_to(0); //默認關閉門

}

void move_to(int angle){//將伺服電機移至一個角度

for(int i = 0; i <= angle; i ++){

locker.write(i);

延遲(10);

}

}

無效循環(){

if(digitalRead(btn)== 1){//如果檢測到按下按鈕

狀態=!(狀態); //切換門狀態

if(state){// if state == true(門已打開)

move_to(90);

}其他{

move_to(0); //如果state == false(門已關閉)

}

延遲(100);

而(digitalRead(btn)== 1){

;

}

}

}

-------------------------------------------------- - - - - - - - - - 該視頻 - - - - - - - - - - - - - - - ---------------------------------------

Step 1:

Step 2: Prepare Material , and How to Build It

------------------------------------------------------------Prepare material--------------------------------------------------------------------

Styrofoam: (bottom)20(hight)20 cm ( 6 pieces)

Styrofoam: (bottom)20(hight)7 cm ( 4 pieces)

Styrofoam: (bottom)19*(hight)19 cm ( 1 pieces)

scissors

Utility Knife

110v socket set *1

butterfly hinge*1

Arduino Leonardo board

Bread Board

wire

motor*1

push button*1

blue resistance ( gold, black, black, Brown, Brown,)

Hot glue gun

--------------------------------------------------------------How to make it?------------------------------------------------------------------Step one: Cut a rectangle hole on the middle of Styrofoam (bottom)20(hight)20 cm, then remove the green wire box from110v socket set, then glue the left and right side of the push button on to the Three plug holes at the rear of the socket group.

Step two: Glue the butterfly hinge*1 left sideon theStyrofoam (bottom)20(hight)20 cm (The styrofoam with the rectangle hole ) Glue the right-side butterfly hinge*1 on the rear side of push-button + 110v socket set. Then build an arched using the left material to make the latch with the motor arm.

Step Three: After building the Arduino boards as I make at the top, glue it on Styrofoam (bottom)20(hight)20 cm then glue Styrofoam: (bottom)20(hight)7 cm ( 4 pieces) at the east, west, south, north of Styrofoam (bottom)20(hight)20 cm( remember to cut a square hole at the east board for the connecting wire for computer and Arduino){1}.

Step Four: Then glue aStyrofoam: (bottom)19*(hight)19 cm ( 1 piece) on the top of Styrofoam: (bottom)20(hight) 7 cm ( 4 pieces)+Styrofoam (bottom)20(hight)20 cm, then glue the restStyrofoam: 4 (bottom)20(hight)20 cm on the top, behind, west and east ( East had to cut one more hole because of {1}.Then your hidden socket Safe is finished, connect with computer code check if there is any problem.