Devices & Components
Arduino Uno Rev3
Jumper wires (generic)
LED (generic)
Resistor 220 ohm
Software & Tools
Arduino IDE
Project description
Code
code for led chaser
c_cpp
first we should define all pins .secondly we should deside if the are output or input and of course led's are output. here we will make the first pin high and the second pin high and so on.
1int led1 = 13; //first we should define all pins 2int led2 = 12; 3int led3 = 11; 4int led4 = 10; 5int led5 = 9; 6int led6 = 8; 7int led7 = 7; 8int led8 = 6; 9int led9 = 5; 10int led10 = 4; 11int led11 = 3; 12int led12 = 2; 13 14void setup() { 15// put your setup code here, to run once: 16// secondly we should deside if the are output or input and of course led's are output 17pinMode(13,OUTPUT); 18pinMode(12,OUTPUT); 19pinMode(11,OUTPUT); 20pinMode(10,OUTPUT); 21pinMode(9,OUTPUT); 22pinMode(8,OUTPUT); 23pinMode(7,OUTPUT); 24pinMode(6,OUTPUT); 25pinMode(5,OUTPUT); 26pinMode(4,OUTPUT); 27pinMode(3,OUTPUT); 28pinMode(2,OUTPUT); 29} 30 31void loop() { 32 // put your main code here, to run repeatedly: 33digitalWrite(led1,HIGH);// here we will make the first pin high and the second pin high and so on. 34delay(100); 35digitalWrite(led2,HIGH); 36delay(100); 37digitalWrite(led3,HIGH); 38delay(100); 39digitalWrite(led4,HIGH); 40delay(100); 41digitalWrite(led5,HIGH); 42delay(100); 43digitalWrite(led6,HIGH); 44delay(100); 45digitalWrite(led7,HIGH); 46delay(100); 47digitalWrite(led8,HIGH); 48delay(100); 49digitalWrite(led9,HIGH); 50delay(100); 51digitalWrite(led10,HIGH); 52delay(100); 53digitalWrite(led11,HIGH); 54delay(100); 55digitalWrite(led12,HIGH); 56delay(100); 57digitalWrite(led1,LOW); 58delay(100); 59digitalWrite(led2,LOW); 60delay(100); 61digitalWrite(led3,LOW); 62delay(100); 63digitalWrite(led4,LOW); 64delay(100); 65digitalWrite(led5,LOW); 66delay(100); 67digitalWrite(led6,LOW); 68delay(100); 69digitalWrite(led7,LOW); 70delay(100); 71digitalWrite(led8,LOW); 72delay(100); 73digitalWrite(led9,LOW); 74delay(100); 75digitalWrite(led10,LOW); 76delay(100); 77digitalWrite(led11,LOW); 78delay(100); 79digitalWrite(led12,LOW); 80delay(100); 81 82 83}
Downloadable files
schematic for led chaser
First we should connect all cathode legs of led's to negative using resistor and then all anode legs to all digital pins on the Arduino uno
schematic for led chaser

schematic for led chaser
First we should connect all cathode legs of led's to negative using resistor and then all anode legs to all digital pins on the Arduino uno
schematic for led chaser

Comments
Only logged in users can leave comments