This was a project to introduce myself into Arduino:

Traffic lights

This project was just to learn the most basic things of arduino, so if you want to see a project with a bit more difficulty, click here: Final term project .

Here's the list of components I used:

And here is the scheme of the circuit, made with fritzing:

Below you have the code I developed:

 
    int ledRed=9;
    int ledGreen=10;
    int ledBlue=11;
    void setup()
    { pinMode(ledBlue,OUTPUT);
    pinMode(ledGreen,OUTPUT);
    pinMode(ledRed,OUTPUT);}
    void loop()
    { digitalWrite(ledBlue,HIGH);
    delay(3000);
    digitalWrite(ledBlue,LOW);
    delay(500);
    digitalWrite(ledGreen,HIGH);
    delay(2000);
    digitalWrite(ledGreen,LOW);
    delay(500);
    digitalWrite(ledRed,HIGH);
    delay(3000);
    digitalWrite(ledRed,LOW);
    delay(500); }
  

This code is quite simple. By using it, you are defining the leds as an integer variable, which are outputs connected to 9,10 and 11. Once the variables are defined, you are telling the arduino to start turning on and off the leds, with a delay of 3000, 2000 or 500 milliseconds: