Arduino Traffic Light Summative


You should read Physical Pixel first.                


Interface Circuit

Parallel Port Cable

Ha! You don't even need to make a cable! Your USB carries all the info from your computer to the Arduino.

Interfacing LEDs

Connect LEDs by simply using a breadboard with resistors and connections to the traffic lights. Elastic band your Arduino onto the breadboard. Use the same idea as the Parallel Port version.

Code: Controlling the LEDs


Two options: Arduino Only or Ardunio Controlled By Processing. I give you the Arduino code skeleton to build off of.

Arduino Only

Basically a version of Knight Rider and the Processing Traffic Light Project - use a simple counter and tick through several states. We won't build it this way for the reasons given next.

Arduino Controlled By Processing

Because we need to control the application through an interface we will need something that can be controlled from Processing - so we will modify the Arduino only version to run more like it is being controlled from Processing. For this we will use a variation of 

Arduino Skeleton

Basically a variation of the Physical Pixel. Construct a Processing interface that then uses the built in communication features of Arudino. Simple print letters to the Aruindo which then come into a variable that you can then use to control the Aruidno. Untested but model program given.

But first be sure you have read Physical Pixel and read the code! Remember:
  1. The Arduino code in PhysicalPixel has a massive comment at the end with Processing code in it!
  2. SET THE CORRECT PORT - the code says this:
 // List all the available serial ports in the output pane. 
 // You will need to choose the port that the Arduino board is 
 // connected to from this list. The first port in the list is 
 // port #0 and the third port in the list is port #2. 
 println(Serial.list()); 
 
 // Open the port that the Arduino board is connected to (in this case #0) 
 // Make sure to open the port at the same speed Arduino is using (9600bps) 
 port = new Serial(this, Serial.list()[0], 9600); 

    3. Close down your Processing interface when making changes to the Arduino code. If you don't then your code won't upload to the Arduino which of course is a problem.

Arduino Code - Mr. C's Untested Arduino Code

>>Here is the code <<<< to run on your Aruduino! You still need to add some of your own code to this though.

Processing Interface

Same as Parallel Port version.

Comments