Introduction: Light Sensitive Worm Using Arduino Uno

Hey guys, after a long time I am writing. I hope you guys are all good. Today I am writing an easy instructable but you will get fun from it, confirmed!

Step 1: Required Components:-

1.Arduino Uno

2.LDR(light dependent resistor)

3.LED (10 pieces)

4.Resistor(100 ohm and 100K)

5.Male to Male jumpers

6.Bread board

Step 2: Attach All of Them According to the Picture

Step 3: Required Code:-

int LDRvalue=0;

int LDRsensitivity=400;

void setup()

{ pinMode(13,OUTPUT);

pinMode(12,OUTPUT);

pinMode(11,OUTPUT);

pinMode(10,OUTPUT);

pinMode(9,OUTPUT);

pinMode(8,OUTPUT);

pinMode(7,OUTPUT);

pinMode(6,OUTPUT);

pinMode(5,OUTPUT);

pinMode(4,OUTPUT);

Serial.begin(9600); }

void loop() {

int i=13;

int j=12;

for(int k=0;i<=13&&i>=4&&j<=12&&i>=4;k=k+1){

LDRvalue=analogRead(A0);

Serial.println(LDRvalue);

if(LDRvalue>LDRsensitivity){

Serial.println(i);

Serial.println(j);

digitalWrite(i,HIGH);

digitalWrite(j,HIGH);

delay(100);

digitalWrite(i,LOW);

digitalWrite(j,LOW);

i=i-1;

j=j-1;

delay(100);

}

else{

Serial.println(i);

Serial.println(j);

digitalWrite(i,HIGH);

digitalWrite(j,HIGH);

delay(100);

digitalWrite(i,LOW);

digitalWrite(j,LOW);

i=i+1;

j=j+1;

delay(100);

}

}

}

Step 4: See My Video on Youtube

Thank You.

Comments

About This Instructable

169views

3favorites

License:

More by ProbhakarS:MEASUREMENT OF RPM OF DC MOTOR USING ARDUINO AND IR LEDLight Sensitive Worm Using Arduino UnoHow to Make BUZZER From RELAY Switch (Introduction)
Add instructable to: