# data[].attributes.attachment_link.title
발명직무연수 강의자료(강동초오재경)1125

# data[].attributes.headline
회로기판 이미지 입니다.(온습도 측정기)다운받아서 확대해서 활용해주세요

# data[].attributes.subject
회로기판 이미지 입니다.(온습도 측정기)다운받아서 확대해서 활용해주세요

# data[].attributes.attachment_link.title
회로기판 연결(온습도측정기)

# data[].attributes.attachment_link.title
CH341SER아두이노설치드라이버

# data[].attributes.body
압축을 풀어서 사용하세요

# data[].attributes.headline
1. 아두이노 소스코드(온습도 측정)

# data[].attributes.subject
1. 아두이노 소스코드(온습도 측정)

# data[].attributes.body
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT11.h>

//LCD 설정
LiquidCrystal_I2C lcd(0x27,16,2);

//온습도센서 연결설정
int pin=2;
int REDpin = 6;
int BLUEpin = 7;
int piezo = 8;
int notes[] ={523,587};

DHT11 dht11(pin);

void setup()
{
lcd.begin();
Serial.begin(9600);
pinMode(REDpin, OUTPUT);

}

void loop()
{
int err;
float temp, humi;
if((err=dht11.read(humi, temp))==0)
{
lcd.backlight();
lcd.display();
lcd.print("TEMP:     ");
lcd.print(temp);
lcd.setCursor(0,1);
lcd.print("HUMIDITY: ");
lcd.print(humi);

Serial.print("temp: ");
Serial.print(temp);
Serial.print("humi: ");
Serial.print(humi);
Serial.println();
}
else
{
lcd.backlight();
lcd.display();
lcd.print("ERROR NO.: ");
lcd.print(err);
}
delay(10000); //10초마다 Refresh
lcd.clear();

if (temp > 25) {
digitalWrite(REDpin, HIGH);
}
else {digitalWrite(REDpin, LOW);
}

if (humi > 30) {
digitalWrite(BLUEpin, HIGH);
}
else {digitalWrite(BLUEpin, LOW);
}

if(temp > 25& humi > 30){
for(int i=0;i<2;i++){
tone(piezo,notes[i],1000);
delay(1000);
noTone(piezo);
}
}
}

# data[].attributes.headline
2. 아두이노 소스코드(멜로디 부저)

# data[].attributes.subject
2. 아두이노 소스코드(멜로디 부저)

# data[].attributes.body
#define NOTE_C5  523    //도
#define NOTE_D5  587    //레
#define NOTE_E5  659    //미
#define NOTE_F5  698    //파
#define NOTE_G5  784    //솔
#define NOTE_A5  880    //라
#define NOTE_B5  988    //시
#define NOTE_C6  1047   //도

int tonepin = 5;

int sw = 3;

int melody[] = {

NOTE_C5,NOTE_C5,NOTE_C5,NOTE_C5,NOTE_C5,

NOTE_E5,NOTE_G5,NOTE_G5,NOTE_E5,NOTE_C5,

NOTE_G5,NOTE_G5,NOTE_E5,NOTE_G5,NOTE_G5,NOTE_E5,

NOTE_C5,NOTE_C5,NOTE_C5,

NOTE_G5,NOTE_G5,NOTE_E5,NOTE_C5,

NOTE_G5,NOTE_G5,NOTE_G5,

NOTE_G5,NOTE_G5,NOTE_E5,NOTE_C5,

NOTE_G5,NOTE_G5,NOTE_G5,

NOTE_G5,NOTE_G5,NOTE_E5,NOTE_C5,

NOTE_G5,NOTE_G5,NOTE_G5,NOTE_A5,NOTE_G5,

NOTE_C6,NOTE_G5,NOTE_C6,NOTE_G5,

NOTE_E5,NOTE_D5,NOTE_C5,

};

int noteDurations[]={

4,8,8,4,4,

4,8,8,4,4,

8,8,4,8,8,4,

4,4,2,

4,4,4,4,

4,4,2,

4,4,4,4,

4,4,2,

4,4,4,4,

8,8,8,8,2,

4,4,4,4,

4,4,2

};

void setup() {

pinMode(tonepin, OUTPUT);

pinMode(sw, INPUT_PULLUP);

}

void loop() {

if (digitalRead(sw) == LOW) {

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

int Durations = 1000/noteDurations[i];    // 음계의 음길이 계산

tone(tonepin, melody[i], Durations);

int pauseBetweenNotes = Durations *1.3 ;

delay(pauseBetweenNotes);

noTone(tonepin);

}

}

}

# data[].attributes.headline
3. 아두이노 소스코드(적외선리모컨)

# data[].attributes.subject
3. 아두이노 소스코드(적외선리모컨)

# data[].attributes.body
/* IR-적외선 리모트 모듈 리모콘 ‘xinda’ 실습 3      */
/* 숫자 키로 LED 켜기, Rasino.tistory.com, Alex KIM  */
#include<IRremote.h>
#define IR_KEY_1 0xFFA25D
#define IR_KEY_2 0xFF629D
#define IR_KEY_3 0xFFE21D
#define IR_KEY_4 0xFF22DD
#define IR_KEY_5 0xFF02FD
#define IR_KEY_6 0xFFC23D
#define IR_KEY_7 0xFFE01F
#define IR_KEY_8 0xFFA857
#define IR_KEY_9 0xFF906F
int IRPIN = 7;
int G = 8;
int B = 9;
int R = 10;
int W = 11;
IRrecv irDetect(IRPIN);
decode_results irIn;
void setup() {
Serial.begin(9600);
irDetect.enableIRIn();
pinMode(G, OUTPUT);
pinMode(B, OUTPUT);
pinMode(R, OUTPUT);
pinMode(W, OUTPUT);
for(int i=8; i<=11; i++)
{pinMode(i, OUTPUT);}
}
void loop() {
if (irDetect.decode(&irIn)) {
decodeIR();
irDetect.resume();  }  }
void decodeIR() {
switch(irIn.value) {
case IR_KEY_1:
digitalWrite(G, HIGH);
delay(2000);
digitalWrite(G, LOW);
break;
case IR_KEY_2:
digitalWrite(B, HIGH);
delay(2000);
digitalWrite(B, LOW);
break;
case IR_KEY_3:
digitalWrite(R, HIGH);
delay(2000);
digitalWrite(R, LOW);
break;
case IR_KEY_4:
digitalWrite(W, HIGH);
delay(2000);
digitalWrite(W, LOW);
break;
case IR_KEY_5:
digitalWrite(G, HIGH);
digitalWrite(B, HIGH);
delay(2000);
digitalWrite(G, LOW);
digitalWrite(B, LOW);
break;
case IR_KEY_6:
digitalWrite(G, HIGH);
digitalWrite(B, HIGH);
digitalWrite(R, HIGH);
delay(2000);
digitalWrite(G, LOW);
digitalWrite(B, LOW);
digitalWrite(R, LOW);
break;
case IR_KEY_7:
digitalWrite(W, HIGH);
digitalWrite(B, HIGH);
digitalWrite(R, HIGH);
delay(2000);
digitalWrite(W, LOW);
digitalWrite(B, LOW);
digitalWrite(R, LOW);
break;
case IR_KEY_8:
for(int i=8; i<=11; i++)
{digitalWrite(i, HIGH);
delay(500);
digitalWrite(i, LOW);}
break;
case IR_KEY_9:
digitalWrite(G, HIGH);
digitalWrite(B, HIGH);
digitalWrite(R, HIGH);
digitalWrite(W, HIGH);
delay(2000);
digitalWrite(G, LOW);
digitalWrite(B, LOW);
digitalWrite(R, LOW);
digitalWrite(W, LOW);
break;
}
}