Devices & Components
Arduino Uno Rev3
10 ohm resistor
Male/Male Jumper Wires
LED (generic)
Solderless Breadboard Full Size
Pushbutton switch 12mm
Project description
Code
code
arduino
It's temporary, only for use, it will not work if something goes incorrect
1int l[]={0,0,0,0,0,0},T=6,a,p; 2const int b1=12,b2=13; 3void setup() { 4pinMode(2,OUTPUT); 5pinMode(3,OUTPUT); 6pinMode(4,OUTPUT); 7pinMode(5,OUTPUT); 8pinMode(6,OUTPUT); 9pinMode(7,OUTPUT); 10pinMode(b1,INPUT); 11pinMode(b2,INPUT); 12} 13void loop() { 14p=0; 15p=digitalRead(b1) ; 16while(digitalRead(b1)!=0) 17{ 18 19} 20delay(100); 21a=T-1; 22while(a>=0&&p==1) 23{ 24 if(l[a]==1) 25 { 26 l[a]=0; 27 a--; 28 } 29 else 30 { 31 l[a]=1; 32 p=0; 33 } 34} 35p=digitalRead(b2) ; 36while(digitalRead(b2)!=0) 37{ 38 39} 40delay(100); 41a=T-1; 42while(a>=0&&p==1) 43{ 44 if(l[a]==0) 45 { 46 l[a]=1; 47 a--; 48 } 49 else 50 { 51 l[a]=0; 52 p=0; 53 } 54} 55a=T-1; 56for(int c=0;c<T;c++) 57{ 58 if(l[c]==1) 59 digitalWrite(T-c+1,HIGH); 60 else 61 digitalWrite(T-c+1,LOW); 62 a--; 63} 64} 65
code
arduino
It's temporary, only for use, it will not work if something goes incorrect
1int l[]={0,0,0,0,0,0},T=6,a,p; 2const int b1=12,b2=13; 3void setup() 4 { 5pinMode(2,OUTPUT); 6pinMode(3,OUTPUT); 7pinMode(4,OUTPUT); 8pinMode(5,OUTPUT); 9pinMode(6,OUTPUT); 10pinMode(7,OUTPUT); 11pinMode(b1,INPUT); 12pinMode(b2,INPUT); 13} 14void 15 loop() { 16p=0; 17p=digitalRead(b1) ; 18while(digitalRead(b1)!=0) 19{ 20 21} 22delay(100); 23a=T-1; 24while(a>=0&&p==1) 25{ 26 27 if(l[a]==1) 28 { 29 l[a]=0; 30 a--; 31 } 32 else 33 { 34 l[a]=1; 35 36 p=0; 37 } 38} 39p=digitalRead(b2) ; 40while(digitalRead(b2)!=0) 41{ 42 43 44} 45delay(100); 46a=T-1; 47while(a>=0&&p==1) 48{ 49 if(l[a]==0) 50 51 { 52 l[a]=1; 53 a--; 54 } 55 else 56 { 57 l[a]=0; 58 p=0; 59 60 } 61} 62a=T-1; 63for(int c=0;c<T;c++) 64{ 65 if(l[c]==1) 66 digitalWrite(T-c+1,HIGH); 67 68 else 69 digitalWrite(T-c+1,LOW); 70 a--; 71} 72} 73
Downloadable files
Circuit Diagram
I tried to make it as presentable as its originally made in. Except resistors, because I didn't had correct values of resistors. Make sure you use 10 ohm resistors
Circuit Diagram
Comments
Only logged in users can leave comments