[WAT-S028] 중요한 아두이노 센서키트 28번째 [CDS Photoresistor 센서]

[WAT-S028] CDS Photoresistor 센서 모듈

본 제품은 [WAT-SK114]중요한 아두이노 센서키트(초급) 중 28번째 모듈로 CDS Photoresistor 센서 모듈입니다.

핀 번호

번호 핀명 I/O 기능
 1 S S+ Sensor+
 2 + VCC VCC
3 GND GND

WAT-Arduino128 예제

핀 연결
번호 I/O WAT-Arduino128
 1 S A0
 2 + VCC
3 GND

소스코드

최신 소스코드는 [파일]=>[예제]=>[WhiteAT]=> [Sensor37] => [28_CDS] 에 있으며
라이브러리는 아두이노 개발환경  을 참조하세요

/*
 중요한 아두이노 센서키트 37종 예제 중 28 번째
 WAT-Arduino128 과 CDS Photoresistor (조도) 센서 예제입니다.

 WAT-Arduino128 : https://kit128.com/goods/view?no=64
 37종 센서: https://kit128.com/goods/view?no=114
 출처: http://whiteat.com/Arduino
*/ 

int S = A0; // INPUT PIN

// 프로그램 시작 - 초기화 작업
void setup()
{
 Serial.begin(115200); // 시리얼 통신 초기화
 Serial.println("Arduino Examples - CDS Photoresistor Sensor");
 Serial.println(" https://docs.whiteat.com/?p=1284");
 pinMode(S, INPUT);
}

int adcvalue = 0;
void loop()
{
 adcvalue = analogRead(S);
 Serial.print("S="); Serial.println(adcvalue, DEC); 
 delay(100);
}
결과 화면

밝으면 100 정도, 어두우면 1000 정도의 값을 출력합니다.

Arduino UNO R3 예제

핀 연결
번호 I/O UNO R3
 1 S A0
 2 + VCC
3 GND GND

 

소스코드

최신 소스코드는 [파일]=>[예제]=>[WhiteAT UNO]=> [Sensor37] => [28_CDS] 에 있으며
라이브러리는 아두이노 개발환경  을 참조하세요

/*
 중요한 아두이노 센서키트 37종 예제 중 28 번째
 UNO 와 CDS Photoresistor (조도) 센서 예제입니다.

 UNO R3 : https://kit128.com/goods/view?no=337
 37종 센서: https://kit128.com/goods/view?no=114

 출처: http://whiteat.com/Arduino
*/ 

int S = A0; // INPUT PIN

// 프로그램 시작 - 초기화 작업
void setup()
{
 Serial.begin(115200); // 시리얼 통신 초기화
 Serial.println("Arduino Examples - CDS Photoresistor Sensor");
 Serial.println(" https://docs.whiteat.com/?p=1284");
 pinMode(S, INPUT);
}

int adcvalue = 0;
void loop()
{
 adcvalue = analogRead(S);
 Serial.print("S="); Serial.println(adcvalue, DEC); 
 delay(100);
}
결과 화면

밝으면 100 정도, 어두우면 1000 정도의 값을 출력합니다.

 

제품 구매

[WAT-SK114]중요한 아두이노 센서키트(초급)은 https://kit128.com/goods/view?no=114 에서
[WAT-S028] CDS Photoresistor 센서는 https://kit128.com/goods/view?no=428 에서 구매하실 수 있습니다.

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다