Photo Resistor Module (KY-018) [S002]


 

https://www.youtube.com/watch?v=EKLfcRSVAVc


*GitHubhttps://github.com/rdiot/rdiot-s002.git

 

* Specs
Photoresistors are semiconductor photosensitive devices,
in addition to having high sensitivity, fast response, consistent with the spectral characteristics and value of good features, but at a high temperature, and humidity in harsh environments, but also to maintain
a high degree of stability and reliability, wide pan used cameras, solar garden lights, lawn, detectors, clock, music, cups, gift boxes, mini-Night light, light voice switches, lights automatically switch toys and a variety of light control, light control lighting, lamps and other light automatic opening OFF control field


* Contents
- Connect
S - A1
middle - 5V
- GND

 

- Key Code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
 
LiquidCrystal_I2C lcd(0x27,20,4);  // LCD2004
 
int sensorPin1 = A0;
int sensorPin2 = A1; //S002
 
void setup()
{
  lcd.init();  // initialize the lcd
  lcd.backlight();
  lcd.print("start LCD2004");
}
 
void loop()
{
  int rate1 = analogRead(sensorPin1);
  int rate2 = analogRead(sensorPin2);

  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("[1]CDS05MM=" + (String)rate1);
  lcd.setCursor(0,1);
  lcd.print("[2]KY-018=" + (String)rate2);
 
  delay(200);
}

Posted by RD IoT RDIoT

댓글을 달아 주세요