FOUR WAY TRAFFIC LIGHT WITH CLOUDX M633 CloudX

  • img
Project Details

This is a simple 4-way Traffic Light Controller . The LEDs are controlled by CloudX M633

 

Component:

CloudX M633

USB Cable

330 ohm(resistor)

LEDS (4 red led, 4 yellow led, 4 green led.)

 

 

 



#define RED1 pin1 
#define YELLOW1 pin2 
#define GREEN1 pin3 
#define RED2 pin4 
#define YELLOW2 pin5
#define GREEN2 pin6 
#define RED3 pin7
#define YELLOW3 pin8 
#define GREEN3 pin9 
#define RED4 pin10 
#define YELLOW4 pin11 
#define GREEN4 pin12 


setup(){
           //setup here
           portMode(1,OUTPUT);
           portMode(2, 0b11110000);
  //////////////////////////////////////////////////
  
           RED1   = 0;
           YELLOW1  = 0;
           GREEN1 = 0;
           
           RED2   = 0;
           YELLOW2  = 0;
           GREEN2 = 0;
           
           RED3   = 0;
           YELLOW3  = 0;
           GREEN3 = 0;
           
           RED4   = 0;
           YELLOW4  = 0;
           GREEN4 = 0;
           
 //////////////////////////////////////////////////////////////////////////////////////////////          
loop(){
           //Program here
          
           GREEN1 = 1;
           RED2   = 1;
           RED3   = 1;
           RED4   = 1;
           delay(9000);
           
           GREEN1 = 0;
           RED2   = 0;
           YELLOW1 = 1;
           YELLOW2 = 1;
           delay(3000);
           
           YELLOW1 = 0;
           YELLOW2 = 0;
           RED1   = 1;
           GREEN2 = 1;
           delay(9000);
           
           GREEN2 = 0;
           RED3   = 0;
           YELLOW2 = 1;
           YELLOW3 = 1;
           delay(3000);
           
           YELLOW2 = 0;
           YELLOW3 = 0;
           RED2   = 1;
           GREEN3 = 1;
           RED4   = 1;
           delay(9000);
           
           GREEN3 = 0;
           RED4   = 0;
            
           YELLOW3 = 1;
           YELLOW4 = 1;
           delay(3000);
           
           YELLOW3 = 0;
           YELLOW4 = 0;
           RED3   = 1;
           GREEN4 = 1;
           delay(9000);
           
           RED3    = 0;
           GREEN4  = 0;
           RED1    = 0;
           YELLOW1 = 1;
           YELLOW4 = 1;
           delay(3000);
           
           YELLOW1 = 0;
           YELLOW4 = 0;
  
      }
}

 

Share this with friends