Program: Traffic light Finch

traffic signal
http://www.flickr.com/photos/video4net/4103124627

It's late at night and the corner traffic signal has broken down.
If the Finch can demonstrate the ability to follow the correct pattern for the corner traffic light,
you can earn big money hiring your robot out for the evening.
The corner traffic light is green for 4 seconds, yellow for half of a second and red for 2 seconds.

You will need to use the setLED and sleep commands to complete this program.

Copy and paste this program and add in your own information
to make the Finch's beak turn the right colors at the right times.

     
import edu.cmu.ri.createlab.terk.robot.finch.Finch; // Use the Finch methods
import java.awt.Color; // Use colors 

/**
 * Created by: Yourname
 * Date: Today's date
 * Put your description here
 */

public class YourProgramName
   {
   public static void main(String[] args)
      {
      // PUT YOUR code HERE


      // Always end your program so the Finch will be reset for the next program
      myFinch.quit();
      System.exit(0);
      }
   }

  1. green for 4 seconds
    yellow for half of a second
    and red for 2 seconds.
    Create a new class in Java
    Give it a sensible name for a traffic light program
    NOTE: class names should start with a Capital letter and have no blank spaces in the name
  2. Copy in the code above
    Add in your own code to set the LED colors for the right amounts of time.
  3. Compile and run your code to see if you have the right program.

Below is a Finch robot doing its best to impersonate a traffic light

Challenge: try the Morse code program