Light_Sensor_Lesson - jimaobian/DFRobotWiki GitHub Wiki
Introduction
Connection Diagram
Code Sample
//For Arduino Start kit
//Compatible with all Arduino version
//Last updated 2011-1-13
//www.dfrobot.com
//Light Control Sound Lesson
void setup()
{
pinMode(6,OUTPUT);
}
void loop()
{
while(1)
{
char i,j;
while(1)
{
for(i=0;i<80;i++) //Make some sound
{
digitalWrite(6,HIGH);
delay(1);
digitalWrite(6,LOW);
delay(1);
}
for(i=0;i<100;i++) //Make another sound
{
digitalWrite(6,HIGH);
delay(2);
digitalWrite(6,LOW);
delay(2);
}
}
}
}