[vc_row][vc_column width=”1/1″][vc_column_text]Ambient light sensor breakout board outputs analog signal. When the enviroment is dark, it will output low voltage, and will output high voltage when it’s bright. The output signal range is between 0V to 4V.
This breakout has three pins: output signal, power and ground.
[/vc_column_text][vc_tour][vc_tab title=”Parts List” tab_id=”1389156459-1-58″][vc_column_text]
1 x LinkSprite Ambient Light Senor Breakout
1 x pcDuino v2
Several Jump Wires
[/vc_column_text][/vc_tab][vc_tab title=”Wire Diagram” tab_id=”1389156459-2-14″][vc_column_text]
+ of Ambient Light Sensor -> 5V of pcDuino
– of Ambient Light Sensor -> GND of pcDuino
S of Ambient Light Sensor -> A0 of pcDuino[/vc_column_text][/vc_tab][vc_tab title=”Sample Code” tab_id=”1389157279859-2-8″][vc_column_text]We use the included Arduino IDE in pcDuino:
Sample Code is below:
#include <core.h>
const int analogInPin =0;
int sensorValue = 0; // value read from the pot
int count1;
void setup() {
}
void loop() {
count1++;
// read the analog in value:
sensorValue = analogRead(analogInPin);
if(count1==3000)
{
count1=0;
printf(“sensor=%d\n”, sensorValue);
}
}[/vc_column_text][/vc_tab][vc_tab title=”Results” tab_id=”1389157670481-3-8″][vc_column_text]Click the left-point arrow to run the code on pcDuino, when its bright, the ADC reading is 61. When it’s dark, the ADC reading changes to something like 25.
It’s bright:
It’s dark:
Leave a Reply
You must be logged in to post a comment.