Hello Friends,
I am Cyberautics in previous session we make a fun program using Arduino and led lights.
Now we will make another fun program using Arduino and led.If due to some causes still you not read previous session then you can Click Here .
I am Cyberautics in previous session we make a fun program using Arduino and led lights.
Now we will make another fun program using Arduino and led.If due to some causes still you not read previous session then you can Click Here .
BASIC
- We make connection of LED lights with Arduino and make it.
- we connect LED separately but with common ground.
- we have to program the Arduino for LED sequence
COMPONENTS
- Arduino
- LED Light
- Breadboard/PCB
- Jumper wires
CIRCUIT DIAGRAM
CODE
//make a conection as per diagram...
#define red 3 // define red pin
#define green 4 // define green pin
#define blue 5 // define blue pin
void setup() {
//declaration of output of Red
pinMode(red, OUTPUT);
//declaration of output of Green
pinMode(green, OUTPUT);
//declaration of output of Blue
pinMode(blue, OUTPUT);
Serial.begin(9600);
}
void loop() {
digitalWrite(red, HIGH); //red led high(ON)
delay(1000); // set delay
Serial.println("RED is on");
digitalWrite(red, LOW); // red led low(OFF)
delay(1); //set selay
Serial.println("red is off");
digitalWrite(green, HIGH); //green led is on
delay(1000);
Serial.println("green is on");
digitalWrite(green, LOW); // green led is off
delay(1); //set delay for sleep
Serial.println("green is off");
digitalWrite(blue, HIGH); //blue led on
delay(1000);
Serial.println("blue is on");
digitalWrite(green, LOW); //blue led off
delay(1); //set delay for sleep
Serial.println("blue is off");
}
EXPLANATION
- First of all make a connection as per diagram .
- Copy this code and paste it on the Arduino IDE and compile it .
- After compilation upload it .
- Red, Green and Blue are connected with the Arduino respectively 3,4 and 5.
- When Red LED is on then remaining two LEDs are off same as for Green and Blue .
- When the code is successfully compiled and upload to the Arduino the LED is follow this 3 sequence in some specific delay.
- when red LED is on, green and blue LEDs are off .
- when green LED is on, red and blue LEDs are off.
- when blue LED is on,red and green LEDs are off.
EXERCISE
- Make circuit diagram and Arduino code for following working:
- Use 3 LED Light which is on sequentially and off in reverse sequence.
So, My dear friends I hope this blog very useful for you , if you like this blog please share and if you have any doubt or any question you can contact me.
Nice
ReplyDeleteThank you
DeleteAmazing
ReplyDeleteThanks
ReplyDeleteHad a fun😄
ReplyDeleteEnjoy😂
Delete