kwonminjaehyunsu626정상원Juhyun Kim변성민
Created December 7, 2017

부모님 감지

상황을 가정하고 작게 만든 방을 표현하였습니다.

BeginnerFull instructions provided2 hours99
부모님 감지

Things used in this project

Hardware components

Jumper wires (generic)
Jumper wires (generic)
×11
Arduino UNO
Arduino UNO
×1
piezo buzzer
×1
Breadboard (generic)
Breadboard (generic)
×1
bluetooth
×1
laser
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

1_6_2__bb_foTGz4Tc9W.jpg

Code

Untitled file

Arduino
//조도센서의 성능이나 개인차에 따라 조도센서에 인식되는 값이 다르니 
//(수정) 이라고 써저있는 부분은 개인에 따라 바꿔야 합니다.
//실험했을때 당시 평상시(가렸을때)960 레이저가 조도센서에 비치면 800
#include <SoftwareSerial.h>
int bluetoothTx = 2;
int bluetoothRx = 3;
const int speaker=13;
const int sensorpin=A0;
int a=900; //(수정)
SoftwareSerial bluetooth(bluetoothTx, bluetoothRx);

void setup()
{
  Serial.begin(9600);
   delay(100);
 bluetooth.begin(9600);
  pinMode(speaker, OUTPUT);
}

void loop()
{
  if(bluetooth.available()) {
  char cmd = (char)bluetooth.read();
  if(cmd == 'y') {
  a = 900;
}
 if(cmd == 'n') {
 a = 1023;
  }
 }

  int rate = analogRead(sensorpin);
  Serial.println(rate);
  
  if(rate>a) //(수정)
  {
    digitalWrite(speaker, HIGH);
  }
  else
  {

    digitalWrite(speaker, LOW);

  }
}

Credits

kwonminjae
1 project • 0 followers
Contact
hyunsu626
2 projects • 0 followers
Contact
정상원
1 project • 0 followers
Contact
Juhyun Kim
26 projects • 12 followers
Contact
변성민
0 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.