Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Source/led_photo/LEDOFF.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Source/led_photo/YELLOWLED.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions arduino_code/BlueTooth/mega_bluetooth/mega_bluetooth.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
//주의!!!!
//18핀 ->Tx
//19핀 -> Rx

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("Hello!");
Serial1.begin(9600);
}

void loop() {

// put your main code here, to run repeatedly:
if (Serial1.available()) {
Serial.write(Serial1.read());
}
// Serial –> Data –> BT
if (Serial.available()) {
Serial1.write(Serial.read());
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
int echo = 3;
int trig = 2;
/*echo*/
int echo = 9;
int trig = 8;

void setup()
{
Expand All @@ -18,5 +19,6 @@ void loop()
float duration = pulseIn(echo, HIGH);
float distance = duration * 0.034 / 2;

delay(100);
Serial.println(distance);
}
}
15 changes: 4 additions & 11 deletions arduino_code/Webserver/Mcu_Webserver/Mcu_Webserver.ino
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include<ESP8266WiFi.h>
#include<ESP8266WebServer.h>

const char* ssid = "KT_GIGA_2G_Wave2_9561";
const char* passwd = "ch62be0914";
const char* ssid = "iptime5";
const char* passwd = "";

const int HTTP_PORT = 80;
ESP8266WebServer webServer(HTTP_PORT);
Expand All @@ -18,7 +18,7 @@ bool ledmcuC = false;

void setup(){

Serial.begin(115200);
Serial.begin(9600);
pinMode(ledesp,OUTPUT);
pinMode(ledmcu,OUTPUT);

Expand Down Expand Up @@ -167,11 +167,4 @@ String SendHTML(bool led1_on, uint8_t led2_on){
ptr +="</html>\n";

return ptr;
}







}
73 changes: 73 additions & 0 deletions arduino_code/Webserver/WiFiAccessPoint/WiFiAccessPoint.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
Copyright (c) 2015, Majenko Technologies
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

* * Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

* * Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.

* * Neither the name of Majenko Technologies nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/* Create a WiFi access point and provide a web server on it. */

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>

#ifndef APSSID
#define APSSID "iptime"
#define APPSK ""
#endif

/* Set these to your desired credentials. */
const char *ssid = APSSID;
const char *password = APPSK;

ESP8266WebServer server(80);

/* Just a little test message. Go to http://192.168.4.1 in a web browser
connected to this access point to see it.
*/
void handleRoot() {
server.send(200, "text/html", "<h1>You are connected</h1>");
}

void setup() {
delay(1000);
Serial.begin(9600);
Serial.println();
Serial.print("Configuring access point...");
/* You can remove the password parameter if you want the AP to be open. */
WiFi.softAP(ssid, password);

IPAddress myIP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(myIP);
server.on("/", handleRoot);
server.begin();
Serial.println("HTTP server started");
}

void loop() {
server.handleClient();
}
Empty file.
13 changes: 13 additions & 0 deletions arduino_code/alcohol/alcohol.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
int mq3 = A2;
int red = 7;

void setup(){

Serial.begin(9600);
pinMode(red,OUTPUT);
}

void loop(){
int val = analogRead(mq3);
if(val >= 100) digitalWrite(read,HIGH);
}
156 changes: 156 additions & 0 deletions object/bluetooth_module_prototype.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
#include <Servo.h>
#include <DHT.h>

/*조도 센 관련*/
const int light = A0;// 조도 센서
int light_status = false,key = 0;

/*초음파 관련*/
const int tr = 10;//초음파
const int ec = 11;
int tot_person = 0;//사람수서

/*초음파 관련*/
#define DHTPIN 2
#define DHTTYPE DHT22
DHT dht(DHTPIN,DHTTYPE);

int mq3 = A7;
int red = 3;

/*온습도*/
long pwm_ht = 0;//초기값 설정(마일값과 비교할 이전 시간_주어진 시간간격 차이 시 시간 증가)
long interval_ht = 1000;//시간 간격
/*조도*/
long pvm_light = 0;//초기값 설정(마일값과 비교할 이전 시간_주어진 시간간격 차이 시 시간 증가)
long interval_light = 300;//시간 간격
/*알코올*/
long pwm_ac = 0;//초기값 설정(마일값과 비교할 이전 시간_주어진 시간간격 차이 시 시간 증가)
long interval_ac = 10000;//시간 간격


Servo ms;

int Function_Ultra(int tr,int ec){

int person_num = 0;
digitalWrite(tr,LOW);
delayMicroseconds(2);

digitalWrite(tr,HIGH);

delayMicroseconds(10);
digitalWrite(tr,LOW);
long uncalculation = pulseIn(ec,HIGH);
long result = (uncalculation/2)/29.1;

delay(1000);

if(result < 65){
return 1;
// delay(3000);
}
else return 0;
}

int Function_Light(int val){

unsigned long crmil_light = millis();
if((crmil_light - pvm_light) >= interval_light){//현재 마일값과 이전 시간값과의 차이가 시간 간격일 때
pvm_light = crmil_light;//이전 시간 업데이트 - 시간간격 맞추기
//수행할 작업 코드
if(val > 230){ light_status = false;key == 1 ? 0: 1;}
else {light_status = true;key == 1 ? 0: 1;}

if(light_status == 1 && key == 0){
Serial.println("Light Status is ON");;
Serial1.println("ON");key = 1 ; return 1;}
else if(light_status == 0 && key == 1){
Serial.println("Light Status is OFF"); ;
Serial1.println("OFF");key = 0; return 0;}
else return 3;


}

}

void Function_Alcohol(){
unsigned long crmil_ac = millis();
if((crmil_ac - pwm_ac) >= interval_ac){//현재 마일값과 이전 시간값과의 차이가 시간 간격일 때
pwm_ac = crmil_ac;//이전 시간 업데이트 - 시간간격 맞추기
int val = analogRead(mq3);
if(val >= 0) Serial1.println("Acl1");
else if(val >= 200) Serial1.println("Acl2");
else if(val >= 400){
digitalWrite(red,HIGH);
Serial1.println("Acl3");
}
Serial.print("recent Alcohol:");
Serial.println(val);

}

}

void Function_ht(){
unsigned long crmil_ht = millis();
if((crmil_ht - pwm_ht) >= interval_ht){//현재 마일값과 이전 시간값과의 차이가 시간 간격일 때
pwm_ht = crmil_ht;//이전 시간 업데이트 - 시간간격 맞추기
//수행할 작업 코드
double h = dht.readHumidity();
double t = dht.readTemperature();
/*시리얼*/
Serial1.print("<");
Serial1.print(h);
Serial1.print("(");
Serial1.println(t);
/*시리얼*/
Serial.print("humidity:");
Serial.println(h);
Serial.print("temperature:");
Serial.println(t);

}
}

void setup(){

ms.attach(6);

pinMode(tr,OUTPUT);
pinMode(ec,INPUT);

Serial.begin(9600);
Serial1.begin(9600);
dht.begin();//온습도 센

pinMode(light, INPUT);

pinMode(red,OUTPUT);
digitalWrite(red,LOW);
}

void loop(){

// int lightV = analogRead(light);//조도 센서 값 저
int val = analogRead(light)/4;

int light_st = Function_Light(val);//조도센서 함수 리턴값
//1일때 on | 0일때 off
// if(light_st == 1 || light_st == 0 ){
// Serial.println(light_st);
// }

// int person_num = Function_Ultra(tr,ec);
// if(person_num == 1){
// tot_person ++;
// Serial.print("Total Person : ");
// Serial.println(tot_person);
// }
Function_ht();
Function_Alcohol();
//humidity:
//temperature

}
Loading