Devices & Components
Arduino Uno Rev3
Perma-Proto Breadboard Half Size
5 mm LED: Red
Male/Male Jumper Wires
Resistor 1k ohm
Software & Tools
Arduino IDE
Project description
Code
Blinking of LED
arduino
1const int LED = 3; 2 3void setup() { 4 pinMode (LED, OUTPUT); 5} 6 7void loop() { 8 digitalWrite (LED, HIGH); 9 delay (1000); 10 digitalWrite (LED, LOW); 11 delay (1000); 12}
LED ON for 2s and OFF for 3s
arduino
1const int LED = 3; 2 3void setup() { 4 pinMode (LED, OUTPUT); 5} 6 7void loop() { 8 digitalWrite (LED, HIGH); 9 delay (2000); 10 digitalWrite (LED, LOW); 11 delay (3000); 12}
Fading Effects of LED
arduino
1const int LED_ao = 3; 2 3void setup() { 4 pinMode (LED_ao, OUTPUT); 5} 6 7void loop() { 8 for (int brightness=1; brightness<=255; brightness++) 9 { 10 analogWrite (LED_ao, brightness); 11 delay (10); 12 } 13 for (int brightness=255; brightness>0; brightness--) 14 { 15 analogWrite (LED_ao, brightness); 16 delay (10); 17 } 18}
LED forever ON
arduino
1const int LED = 3; 2 3void setup() { 4 pinMode (LED, OUTPUT); 5} 6 7void loop() { 8 digitalWrite (LED, HIGH); 9 10}
Fade IN and Fade OUT at different speeds
arduino
1const int LED_ao = 3; 2 3void setup() { 4 pinMode (LED_ao, OUTPUT); 5} 6 7void loop() { 8 for (int brightness=1; brightness<=255; brightness++) 9 { 10 analogWrite (LED_ao, brightness); 11 delay (25); 12 } 13 for (int brightness=255; brightness>0; brightness--) 14 { 15 analogWrite (LED_ao, brightness); 16 delay (5); 17 } 18}
Downloadable files
Circuit Diagram
Created using Visio Professional
Circuit Diagram
Breadboard Diagram
Make connections as shown in the figure.
Breadboard Diagram

Schematic Diagram
Schematic Diagram

Comments
Only logged in users can leave comments