วันอังคารที่ 27 มีนาคม พ.ศ. 2561

ส่งงานครั้งที่19

Arduino Based 3-Way Traffic Light Controller

Components Required:

  1. 3*Red LED Lights
  2. 3*Green LED Lights
  3. 3*Yellow LED Lights
  4. 3*220ohm Resistors
  5. Breadboard
  6. Male To Male Connectors
  7. Arduino Uno With Ide Cable
CODE
 void setup() {
  // configure the output pins
  pinMode(2,OUTPUT);
  pinMode(3,OUTPUT);
  pinMode(4,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
  pinMode(8,OUTPUT);
  pinMode(9,OUTPUT);
  pinMode(10,OUTPUT);
}
void loop() 
{
  digitalWrite(4,1);
  digitalWrite(5,1);
  digitalWrite(8,1);
  digitalWrite(2,0);
  digitalWrite(6,0);  
  digitalWrite(3,0);
  digitalWrite(7,0);
  digitalWrite(10,0);
  digitalWrite(9,0);
  delay(5000);
   
  digitalWrite(6,1);     
  digitalWrite(5,0);  
  delay(1000);
  
  digitalWrite(2,1);
  digitalWrite(8,1);
  digitalWrite(7,1);
  digitalWrite(3,0);    
  digitalWrite(6,0);
  digitalWrite(9,0);
  digitalWrite(5,0);
  digitalWrite(10,0);
  digitalWrite(4,0);
  delay(5000);
  
  digitalWrite(9,1);         
  digitalWrite(8,0);        
  delay(1000);
  
  digitalWrite(5,1);
  digitalWrite(2,1);
  digitalWrite(10,1);
  digitalWrite(6,0);
  digitalWrite(8,0);           
  digitalWrite(4,0);
  digitalWrite(7,0);
  digitalWrite(3,0);
  digitalWrite(4,0);
  digitalWrite(9,0);
  delay(5000);
  
  digitalWrite(3,1);           
  digitalWrite(2,0);
  delay(1000);
}

Arduino based 3-way Traffic light controller circuit

ไม่มีความคิดเห็น:

แสดงความคิดเห็น

Mini Project

Control Lamp 220v  With LDR const int lamp = 12; const int ldrPin=A0; #include <Wire.h> #include <LiquidCrystal_I2C.h>...