AMBULANCE RESCUE SYSTEM

Photo of author

By Jackson Taylor

CIRCUIT


PROGRAM
void setup()
{
  pinMode(A5,OUTPUT);//red1
  pinMode(A4,OUTPUT);//ye1
  pinMode(A3,OUTPUT);//grn1
  pinMode(A2,OUTPUT);////////red2
  pinMode(A1,OUTPUT);////ye2
  pinMode(A0,OUTPUT);////////gr2
  pinMode(13,OUTPUT);//red3
  pinMode(12,OUTPUT);//ye3
  pinMode(11,OUTPUT);//gr3
  pinMode(10,OUTPUT);//red4
  pinMode(9,OUTPUT);//ye4
  pinMode(8,OUTPUT);//gr4
  pinMode(6,INPUT);
  pinMode(5,INPUT);
  pinMode(4,INPUT);
  pinMode(7,INPUT);
  digitalWrite(3,HIGH);
  digitalWrite(4,HIGH);
  digitalWrite(6,HIGH);
  digitalWrite(7,HIGH);
 delay(500);
}
void loop()
{
  on(A5);on(A2);on(11);on(8);
  off(9);off(12);off(A1);off(A4);off(10);off(13);off(A3);off(A0);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  on(9);on(12);on(A1);on(A4);
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  on(10);on(13);on(A3);on(A0);
  off(9);off(12);off(A1);off(A4);off(A5);off(A2);off(11);off(8);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
  on(9);on(12);on(A1);on(A4);
   delay(200);
  sh();
  delay(200);
  sh();
  delay(200);
  sh();
}
void on(int a)
{
  digitalWrite(a,HIGH);
}
void off(int a)
{
  digitalWrite(a,LOW);
}
void sh()
{
 if(digitalRead(4)==0)
 {
     on(9);on(12);on(A1);on(A4);
     delay(500);
   on(A3);on(13);on(10);on(A2);
   off(9);off(12);off(A1);off(A4);off(11);off(8);off(A0);off(A5);
   delay(3000);
     on(9);on(12);on(A1);on(A4);
     delay(500);
 }
 else if(digitalRead(5)==0)
 {
     on(9);on(12);on(A1);on(A4);
     delay(500);
   on(A0);on(A5);on(13);on(10);
   off(9);off(12);off(A1);off(A4);off(A2);off(11);off(8);off(A3);
   delay(3000);
   on(9);on(12);on(A1);on(A4);
     delay(500);
 }
 else if(digitalRead(6)==0)
 {
   on(9);on(12);on(A1);on(A4);
     delay(500);
   on(11);on(A5);on(A2);on(10);
   off(9);off(12);off(A1);off(A4);off(13);off(8);off(A3);off(A0);
   delay(3000);
   on(9);on(12);on(A1);on(A4);
     delay(500);
 }
 else if(digitalRead(7)==0)
 {
    on(9);on(12);on(A1);on(A4);
     delay(500);
   on(8);on(A5);on(A2);on(13);
   off(9);off(12);off(A1);off(A4);off(11);off(10);off(A0);off(A3);
  delay(3000);
  on(9);on(12);on(A1);on(A4);
     delay(500);
}
}
SIMULATION (SCREENSHOT)