Program TRAFICK LIGHT Arduino

Hai Guys kali ini saya akan share Script dari Program Pertigaan lampu lalulintas menggunakan
micro controler "ARDUINO"



int mlgM = 13;
int mlgK = 12;
int mlgH = 11;
int pasM = 10;
int pasK = 9;
int pasH = 8;
int sbyM = 7;
int sbyK = 6;
int sbyH = 5;



void setup() {                

  pinMode(mlgM, OUTPUT);
  pinMode(mlgK, OUTPUT);
  pinMode(mlgH, OUTPUT);
  pinMode(pasM, OUTPUT);
  pinMode(pasK, OUTPUT);
  pinMode(pasH, OUTPUT);
  pinMode(sbyM, OUTPUT); 
  pinMode(sbyK, OUTPUT);
  pinMode(sbyH, OUTPUT);
    
}


void loop() {
  digitalWrite(mlgM, LOW);   
  digitalWrite(mlgK, LOW);
  digitalWrite(mlgH, HIGH);   
  digitalWrite(pasM, HIGH);    
  digitalWrite(pasK, LOW);   
  digitalWrite(pasH, LOW);    
  digitalWrite(sbyM, HIGH);   
  digitalWrite(sbyK, LOW);    
  digitalWrite(sbyH, LOW);   
  delay(5000);
  digitalWrite(mlgM, LOW);   
  digitalWrite(mlgK, HIGH);
  digitalWrite(mlgH, HIGH);   
  digitalWrite(pasM, HIGH);    
  digitalWrite(pasK, LOW);   
  digitalWrite(pasH, LOW);    
  digitalWrite(sbyM, HIGH);   
  digitalWrite(sbyK, HIGH);    
  digitalWrite(sbyH, LOW);   
  delay(2000);
  digitalWrite(mlgM, HIGH);   
  digitalWrite(mlgK, LOW);
  digitalWrite(mlgH, LOW);   
  digitalWrite(pasM, HIGH);    
  digitalWrite(pasK, LOW);   
  digitalWrite(pasH, LOW);    
  digitalWrite(sbyM, LOW);   
  digitalWrite(sbyK, LOW);    
  digitalWrite(sbyH, HIGH);   
  delay(5000);  
  digitalWrite(mlgM, HIGH);   
  digitalWrite(mlgK, LOW);
  digitalWrite(mlgH, LOW);   
  digitalWrite(pasM, HIGH);    
  digitalWrite(pasK, HIGH);   
  digitalWrite(pasH, LOW);    
  digitalWrite(sbyM, LOW);   
  digitalWrite(sbyK, HIGH);    
  digitalWrite(sbyH, HIGH);   
  delay(2000);
  digitalWrite(mlgM, HIGH);   
  digitalWrite(mlgK, LOW);
  digitalWrite(mlgH, LOW);   
  digitalWrite(pasM, LOW);    
  digitalWrite(pasK, LOW);   
  digitalWrite(pasH, HIGH);    
  digitalWrite(sbyM, HIGH);   
  digitalWrite(sbyK, LOW);    
  digitalWrite(sbyH, LOW);   
  delay(5000);  
//by : Renaldy 
  digitalWrite(mlgM, HIGH);   
  digitalWrite(mlgK, HIGH);
  digitalWrite(mlgH, LOW);   
  digitalWrite(pasM, LOW);    
  digitalWrite(pasK, HIGH);   
  digitalWrite(pasH, HIGH);    
  digitalWrite(sbyM, HIGH);   
  digitalWrite(sbyK, LOW);    
  digitalWrite(sbyH, LOW);   
  delay(2000);  
  
}
Yoi gain kira kira begitulah scriptnya untuk video hasil jadinya bakal saya update klo gak sibuk sama PKL, Sekian !
Share on Google Plus

About Unknown

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment