প্রয়োজনীয় যন্ত্রপাতি | পরিমান | প্রোডাক্ট লিংক |
Arduino nano V3 China) | 1 | এখানে ক্লিক করুন |
Mini Breadboard(3×2 inch) | 1 | এখানে ক্লিক করুন |
Male to male jumper | 1 | এখানে ক্লিক করুন |
9V battery | 1 | এখানে ক্লিক করুন |
9V battery connector | 1 | এখানে ক্লিক করুন |
LDR | 1 | এখানে ক্লিক করুন |
Red LED 5mm | 6 | এখানে ক্লিক করুন |
Yellow LED 5mm | 6 | এখানে ক্লিক করুন |
330 ohm ¼ watt resistor | 1 | এখানে ক্লিক করুন |
100K ohm ¼ resistor | 1 | এখানে ক্লিক করুন |
সার্কিট ডায়াগ্রাম ও সার্কিটের ছবি নিচে দেওয়া হল।
এক নজরে সকল কানেকশনঃ
Arduino Nano | Led |
2 | Yellow |
3 | Red |
4 | Yellow |
5 | Red |
6 | Yellow |
7 | Red |
8 | Yellow |
9 | Red |
10 | Yellow |
11 | Red |
12 | Yellow |
13 | Red |
GND | ‘-‘ ve legs of all LEDs through a 330 ohm resistor |
Arduino Nano | LDR | 10K Resistor |
A0 | Pin1 | Pin1 |
5V | Pin2 | |
GND | Pin2 |
প্রোগ্রামঃ
নিচের প্রোগ্রামটি আরডুইনোতে আপলোড করুন।
int i=0,flag=0,j=0;
const int led0 = 2;
const int led1 = 3;
const int led2 = 4;
const int led3 = 5;
const int led4 = 6;
const int led5 = 7;
const int led6 = 8;
const int led7 = 9;
const int led8 = 10;
const int led9 = 11;
const int led10 = 12;
const int led11 = 13;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(led0, OUTPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
pinMode(led5, OUTPUT);
pinMode(led6, OUTPUT);
pinMode(led7, OUTPUT);
pinMode(led8, OUTPUT);
pinMode(led9, OUTPUT);
pinMode(led10, OUTPUT);
pinMode(led11, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:
// delay(100);
// digitalWrite(led1, HIGH);
// delay(100);
int sensorValue = analogRead(A0);
Serial.println(sensorValue);
if(sensorValue<=20)
{
for(i=0;i<=4;i++)
{
digitalWrite(led0, HIGH);
delay(100);
digitalWrite(led1, HIGH);
delay(100);
digitalWrite(led2, HIGH);
delay(100);
digitalWrite(led3, HIGH);
delay(100);
digitalWrite(led4, HIGH);
delay(100);
digitalWrite(led5, HIGH);
delay(100);
digitalWrite(led6, HIGH);
delay(100);
digitalWrite(led7, HIGH);
delay(100);
digitalWrite(led8, HIGH);
delay(100);
digitalWrite(led9, HIGH);
delay(100);
digitalWrite(led10, HIGH);
delay(100);
digitalWrite(led11, HIGH);
delay(100);
digitalWrite(led0, LOW);
delay(100);
digitalWrite(led1, LOW);
delay(100);
digitalWrite(led2, LOW);
delay(100);
digitalWrite(led3, LOW);
delay(100);
digitalWrite(led4, LOW);
delay(100);
digitalWrite(led5, LOW);
delay(100);
digitalWrite(led6, LOW);
delay(100);
digitalWrite(led7, LOW);
delay(100);
digitalWrite(led8, LOW);
delay(100);
digitalWrite(led9, LOW);
delay(100);
digitalWrite(led10, LOW);
delay(100);
digitalWrite(led11, LOW);
delay(100);
}
for(i=5;i>=1;i--)
{
digitalWrite(led0, LOW);
digitalWrite(led1, HIGH);
digitalWrite(led2, LOW);
digitalWrite(led3, HIGH);
digitalWrite(led4, LOW);
digitalWrite(led5, HIGH);
digitalWrite(led6, LOW);
digitalWrite(led7, HIGH);
digitalWrite(led8, LOW);
digitalWrite(led9, HIGH);
digitalWrite(led10, LOW);
digitalWrite(led11, HIGH);
delay(200);
digitalWrite(led0, HIGH);
digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
digitalWrite(led3, LOW);
digitalWrite(led4, HIGH);
digitalWrite(led5, LOW);
digitalWrite(led6, HIGH);
digitalWrite(led7, LOW);
digitalWrite(led8, HIGH);
digitalWrite(led9, LOW);
digitalWrite(led10, HIGH);
digitalWrite(led11, LOW);
delay(100);
flag=1;
}
if(flag==1)
{
for(j=0;j<=4;j++)
{
digitalWrite(led0, HIGH);
delay(100);
digitalWrite(led0, LOW);
digitalWrite(led1, HIGH);
delay(100);
digitalWrite(led1, LOW);
digitalWrite(led2, HIGH);
delay(100);
digitalWrite(led2, LOW);
digitalWrite(led3, HIGH);
delay(100);
digitalWrite(led3, LOW);
digitalWrite(led4, HIGH);
delay(100);
digitalWrite(led4, LOW);
digitalWrite(led5, HIGH);
delay(100);
digitalWrite(led5, LOW);
digitalWrite(led6, HIGH);
delay(100);
digitalWrite(led6, LOW);
digitalWrite(led7, HIGH);
delay(100);
digitalWrite(led7, LOW);
digitalWrite(led8, HIGH);
delay(100);
digitalWrite(led8, LOW);
digitalWrite(led9, HIGH);
delay(100);
digitalWrite(led9, LOW);
digitalWrite(led10, HIGH);
delay(100);
digitalWrite(led10, LOW);
digitalWrite(led11, HIGH);
delay(100);
digitalWrite(led11, LOW);
}
j=0;
}
flag=0;
}
else{
digitalWrite(led0, LOW);
digitalWrite(led1, LOW);
digitalWrite(led2, LOW);
digitalWrite(led3, LOW);
digitalWrite(led4, LOW);
digitalWrite(led5, LOW);
digitalWrite(led6, LOW);
digitalWrite(led7, LOW);
digitalWrite(led8, LOW);
digitalWrite(led9, LOW);
digitalWrite(led10, LOW);
digitalWrite(led11, LOW);
}
}
এবার অন্ধকার পেলেই চেজার লাইটটি তিনটি ভিন্ন প্যটার্নে জ্বলতে থাকবে।
]]>