You are on page 1of 4

// code IE

int pin1 = 2;
int pin2 = 3; //
--6--
int pin3 = 4; // 5 |
| 7
int pin4 = 5; // |--
4--|
int pin5 = 6; // 1 |
| 3
int pin6 = 7; //
--2--
int pin7 = 13;
int pin8 = 8; // gnd1
is display 1's gnd
int gnd2 = 11;
int trig = 10; // gnd2
is display 2's gnd
int timer =10;

void setup(){
pinMode(pin1, OUTPUT);
pinMode(pin2, OUTPUT);
pinMode(pin3, OUTPUT);
pinMode(pin4, OUTPUT); //Sets up all of the pins
pinMode(pin5, OUTPUT);
pinMode(pin6, OUTPUT);
pinMode(pin7, OUTPUT);
pinMode(pin8, OUTPUT);
pinMode(gnd2, OUTPUT);
pinMode(trig, INPUT);
}

void loop() {

if(digitalRead(gnd2 = B1))
{

digitalWrite(pin8, B1);

for (int i=0; i<timer; i++){


digitalWrite(pin1, B1);
digitalWrite(pin2, B1);
digitalWrite(pin3, B1);
digitalWrite(pin4, B1);
digitalWrite(pin5, B1);
digitalWrite(pin6, B1);
// A
digitalWrite(pin7, B0);
delay(1);
digitalWrite(pin1, B1);
digitalWrite(pin2, B1);
digitalWrite(pin3, B1);
digitalWrite(pin4, B1);
digitalWrite(pin5, B1);
digitalWrite(pin6, B1);
digitalWrite(pin7, B1);

delay(1);

for (int i=0; i<timer; i++){


digitalWrite(pin1, B1);
digitalWrite(pin2, B1);
digitalWrite(pin3, B1);
digitalWrite(pin4, B1);
digitalWrite(pin5, B1);
digitalWrite(pin6, B0);
digitalWrite(pin7, B0);
//Ar

delay(1);
digitalWrite(pin1, B1);
digitalWrite(pin2, B1);
digitalWrite(pin3, B1);
digitalWrite(pin4, B1);
digitalWrite(pin5, B1);
digitalWrite(pin6, B1);
digitalWrite(pin7, B0);

delay(1);

for (int i=0; i<timer; i++){


digitalWrite(pin1, B1);
digitalWrite(pin2, B1);
digitalWrite(pin3, B1);
digitalWrite(pin4, B1);
digitalWrite(pin5, B0);
digitalWrite(pin6, B0);
digitalWrite(pin7, B0);
//rd
delay(1);
digitalWrite(pin1, B1);
digitalWrite(pin2, B1);
digitalWrite(pin3, B1);
digitalWrite(pin4, B1);
digitalWrite(pin5, B1);
digitalWrite(pin6, B0);
digitalWrite(pin7, B0);

delay(1);

}
for (int i=0; i<timer; i++){
digitalWrite(pin1, B1);
digitalWrite(pin2, B1);
digitalWrite(pin3, B1);
digitalWrite(pin4, B0);
digitalWrite(pin5, B0);
digitalWrite(pin6, B0);
digitalWrite(pin7, B0);
//du
delay(1);
digitalWrite(pin1, B1);
digitalWrite(pin2, B1);
digitalWrite(pin3, B1);
digitalWrite(pin4, B1);
digitalWrite(pin5, B0);
digitalWrite(pin6, B0);
digitalWrite(pin7, B0);

delay(1);

for (int i=0; i<timer; i++){


digitalWrite(pin1, B1);
digitalWrite(pin2, B1);
digitalWrite(pin3, B0);
digitalWrite(pin4, B0);
digitalWrite(pin5, B0);
digitalWrite(pin6, B0);
digitalWrite(pin7, B0);
//ui

delay(1);
digitalWrite(pin1, B1);
digitalWrite(pin2, B1);
digitalWrite(pin3, B1);
digitalWrite(pin4, B0);
digitalWrite(pin5, B0);
digitalWrite(pin6, B0);
digitalWrite(pin7, B0);

delay(1);

for (int i=0; i<timer; i++){


digitalWrite(pin1, B1);
digitalWrite(pin2, B0);
digitalWrite(pin3, B0);
digitalWrite(pin4, B0);
digitalWrite(pin5, B0);
digitalWrite(pin6, B0);
digitalWrite(pin7, B0);

delay(1);
digitalWrite(pin1, B1);
//in
digitalWrite(pin2, B1);
digitalWrite(pin3, B0);
digitalWrite(pin4, B0);
digitalWrite(pin5, B0);
digitalWrite(pin6, B0);
digitalWrite(pin7, B0);

delay(1);

for (int i=0; i<timer; i++){


digitalWrite(pin1, B0);
digitalWrite(pin2, B0);
digitalWrite(pin3, B0);
digitalWrite(pin4, B0);
digitalWrite(pin5, B0);
digitalWrite(pin6, B0);
digitalWrite(pin7, B0);

delay(1);
digitalWrite(pin1, B1);
//no
digitalWrite(pin2, B0);
digitalWrite(pin3, B0);
digitalWrite(pin4, B0);
digitalWrite(pin5, B0);
digitalWrite(pin6, B0);
digitalWrite(pin7, B0);

delay(1);

}
else {
digitalWrite(pin1, B0);
digitalWrite(pin2, B0);
digitalWrite(pin3, B0);
digitalWrite(pin4, B0);
digitalWrite(pin5, B0);
digitalWrite(pin6, B0);
digitalWrite(pin7, B0);
digitalWrite(pin8, B0);
digitalWrite(gnd2, B0);
delay(600);