Introduction: Experiment 7: Light Control of LED Switch

Picture of Experiment 7: Light Control of LED Switch

Photoresistor is a special resistor, it referred to light resistance also , and its resistance related to the intensity of light directly; light intensity increases, the resistance reduction; light intensity decreases, the resistance increases.

Here, we take a look at using the photoresistor to make a LED light control switch.



Step 1: Parts List

1. PcDuino experimental platform

2. photoresistor


4.resistor:220 ohm

5.resistor:10K ohm

6.the jumper

Step 2: Wire Diagram

Picture of Wire Diagram

Step 3: Sample Code

int photoresistancePin = 0;
int ledPin = 11;
int val = 0;
void setup() {
pinMode(ledPin, OUTPUT);
void loop() {
val = analogRead(photoresistancePin);
digitalWrite(ledPin, LOW);
digitalWrite(ledPin, HIGH);

Step 4: Results

Picture of Results

Bright light environments

Step 5: Results

Picture of Results

Dark environments


About This Instructable




More by pcduino:Use Button to Control LED on pcDuino with JavaUse Arduino and RS232 Shield to interface Integrated UHF RFID reader LSID-0702Experiment 4 Serial Port Communication
Add instructable to: