illumination_sensor (조도센서)
arduino_2016. 2. 13. 20:34
방에 불을 끄면 어두워서 --> led On
const int led_yellow_pin = 13;
const int illumination_sensor = A0;
int value;
void setup() {
// put your setup code here, to run once:
pinMode(led_yellow_pin, OUTPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
value = analogRead(illumination_sensor);
Serial.println(value);
if ( value < 100) {
digitalWrite(led_yellow_pin, HIGH);
} else {
digitalWrite(led_yellow_pin, LOW);
}
}
'arduino_' 카테고리의 다른 글
데이터 사이즈 (0) | 2017.09.21 |
---|---|
10개만 출력 (0) | 2016.03.26 |
아놀로그 핀 디지털 핀으로 대체 가능함 (0) | 2016.02.13 |
랜덤으로 30개의 숫자를 만들고 짝수일때 빨간 홀수일때 블루 (0) | 2016.02.13 |
(smart toilet) 논문 (0) | 2016.01.13 |