[vc_row][vc_column][vc_column_text]
Linker Light Sensor is a photosensitive sensor.
A light sensor, as its name suggests, is a device that is used to detect light. There are many different types of light sensors, each of which works in a slightly different way. A photocell orphotoresistor, for example, is a small sensor that changes its resistance when light shines on it; they are used in many consumer products to determine the intensity of light. A charged coupled device (CCD) transports electrically charged signals, and is used as a light sensor in digital cameras and night-vision devices. Photomultipliers detect light and multiply it.
We can use pcDuino ADC to judge intensity of light by detecting the voltage of LightSensor SIG. We can see how LightSensor control the LED button as below.
[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column width=”1/1″][vc_tour][vc_tab title=”Parts List” tab_id=”1394434444-1-28″][vc_column_text]1. [bigcommerce link=”/pcduino-v2-an-minipc-with-arduino-headers-ubuntu-android-google/” target=”_blank”]pcDuino V2[/bigcommerce] x1
2. [bigcommerce link=”/ldr-ambient-light-module-of-linker-kit-for-pcduino-arduino/” target=”_blank”]Linker Light Sensor[/bigcommerce] x1
3. [bigcommerce link=”/5mm-blue-led-module-of-linker-kit-for-pcduino-arduino/” target=”_blank”]Linker LED[/bigcommerce] x1
4. [bigcommerce link=”/base-shield-of-linker-kit-for-pcduino-arduino/” target=”_blank”]Linker Base[/bigcommerce] x1
5. [bigcommerce link=”/20-cm-cable-for-linker-kit/” target=”_blank”]Linker cable[/bigcommerce] x2[/vc_column_text][/vc_tab][vc_tab title=”Wiring Diagram” tab_id=”1394434444-2-43″][vc_column_text][/vc_column_text][/vc_tab][vc_tab title=”Test Code” tab_id=”1394435082245-2-10″][vc_column_text]
import time import gpio from adc import analog_read led_pin = "gpio2" sensor_pin = 2 def delay(ms): time.sleep(1.0*ms/1000) def setup(): gpio.pinMode(led_pin,gpio.OUTPUT); print " Linker LED Pin : D2 \n Light Sensor Pin : A2" delay(3000) def loop(): while(1): value = analog_read(sensor_pin) print ("value = %4d"%value) if(value<2000) : gpio.digitalWrite(led_pin,gpio.HIGH) else : gpio.digitalWrite(led_pin,gpio.LOW) delay(200) setup() loop()
[/vc_column_text][/vc_tab][vc_tab title=”Results” tab_id=”1394435083588-3-9″][vc_column_text]
Leave a Reply
You must be logged in to post a comment.