스마트폰으로 문 잠그고 열기
- 도어락을 잠궜다가 열어보자.
준비물
- 아두이노 UNO
- 브래드 보드
- 블루투스 모듈
- 릴레이 모듈
- 배럴잭
- electric door strike
- 12V 어답터
문을 잠그고 열기
아두이노와 각종 부품들을 연결해 주자.
아두이노 코드도 짜준다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SoftwareSerial.h> | |
#define RELAY 8 | |
SoftwareSerial btSerial(2, 3); //RX, TX | |
void setup() { | |
pinMode(RELAY, OUTPUT); | |
digitalWrite(RELAY, HIGH); | |
btSerial.begin(9600); | |
} | |
void loop() { | |
if (btSerial.available()) { | |
char c = btSerial.read(); | |
switch (c) { | |
case 'a': | |
digitalWrite(RELAY, LOW); | |
break; | |
case 'b': | |
digitalWrite(RELAY, HIGH); | |
break; | |
} | |
} | |
} |
앱 인벤터를 열고,
코드를 짜준다.
- Youtube 영상
- 작성자 : 윤지은(wonwoowon21@gmail.com)