Electronics Components: Connect I/O Pins on a HomeWork Board
Before you start writing programs to run on a BASIC Stamp to add special effects to your electronics projects, you must first build the circuit(s) that will connect to the I/O pins on the Stamp. Once the circuit is constructed, you can then write a program that controls the circuits that you've connected to each pin.
The BASIC Stamp 2 has a total of 16 separate I/O pins, which means you can connect as many as 16 separate circuits. These 16 I/O circuits are more than enough for most BASIC Stamp projects.
For now, start with a basic circuit that simply connects an LED to one of the Stamp’s output pins. The program that you write and load onto a Stamp can turn each of the 16 I/O pins on (HIGH) or off (LOW) by using simple programming commands. When an I/O pin is HIGH, +5 V is present at the pin. When it's LOW, no voltage is present.
Each I/O pin can handle as much as 20 mA of current, which is more than enough to light an LED. As with any LED circuit, you need to provide a current-limiting resistor in the circuit.
If you forget to include this resistor, you'll destroy the LED, and you might fry the Stamp too — so always be sure to include the current-limiting resistor. A 470Ω resistor is usually appropriate for LED circuits connected to Stamp I/O pins.
Here’s a simple schematic diagram for a circuit that drives an LED from pin 15 of a BASIC Stamp. Notice in this schematic that the pin output is represented by a simple five-sided shape. It's common in schematics to not draw the Stamp as a single rectangle as you would other integrated circuits. Instead, each I/O connection in the circuit is shown using a connector shape.
This is how you might build this circuit on a BASIC Stamp HomeWork board. Notice that the resistor is inserted into the P15 connection and the sixth hole in the second row. The LED’s anode is inserted in the seventh hole in row 2, and the cathode is in one of the Vss connectors.