FOUR WAY TRAFFIC LIGHT WITH CLOUDX MICROCONTROLLER

7600

Intro: FOUR WAY TRAFFIC LIGHT WITH CLOUDX MICROCONTROLLER

Component:

1. CloudX Microcontroller

2. 330 ohm(resistor)

3. 4 red led, 4 yellow led, 4 green led.

Connection:

Follow the circuit for your connection.

For more tutorial on CloudX follow this link

STEP 1: Coding:

Copy the code to your CloudX Editor


#include <CloudX\M633.h>
#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;
  
           
      }
}


To download CloudX microcontroller setup follow this link

Comments

Hello there!

We're glad you want to share something with the Instructables community!

And we’re here to help you out.

In order to be published live on the site, Instructables must consist of the following things:

- Multiple steps showing how you made your project

- Written instructions in each step

- Your own original images

Beyond making your Instructable simply publishable, this guide (https://www.instructables.com/id/How-to-Create-a-Feature-Worthy-Instructable/) explains what is required to have your Instructables featured by our site editors. It’s very helpful, and definitely worth checking out.

We would love to review your project again after you have made the necessary edits, and we will publish your project if it is eligible.

If you have any questions, please feel free to ask right here or send us an email at service@instructables.com.

Best,

Instructables Community Manager