Home Chapter 7 STAMP 2 Flashing an LED

Site Search

GTranslate

Chinese (Simplified) French German Italian Portuguese Russian Spanish
STAMP 2 Flashing an LED

If you are here for the MIDITRON go to the index and continue in Chapter 7.

If you are here for the Basic Stamp 2 have fun.

In order to control many LEDs, you must start with one LED. In this lab you will be using the PBASIC commands HIGH and LOW to turn one LED, and then two LEDs, on and off at different rates and for different periods of time. From here you will learn to sequence two LEDs off and on, and then you will use a switch to turn the LEDs off and on determined by your input of a  micro switch.

The circuits you build will all be expanded by your new ability to program different timing of events using the PAUSE command.

The final program will teach you how to use a switch to count events, where the number of times you press a button determines the number of times the LED flashes.

Counting events in time may allow your robot to make intelligent decisions based on changing events in real-time and function as a kind of malleable memory for your Basic Stamp 2.

 

 


Pictured at right is an LED—the long lead is the anode and the short lead is the cathode. Pictured above is the schematic symbol for a light emitting diode.

 

The LED is a semiconductor light. It is also a diode, meaning current will travel in only one direction, but unlike other diodes, the LED gives off light in the process of passing electron current. LEDs are available in a variety of colors: red, green, yellow, amber, and blue, and they also come in a variety of brightnesses. Notice the difference in the schematic symbol with two small arrows coming out indicating it is a light emitting diode and not just a diode.

You can also use LEDs to mix color and can use red, green, and blue to create varieties of RGB color. Now, special RGB LEDs are also available. Because LEDs do not have filaments, they do not burn out as quickly, and they also do not get hot like incandescent bulbs. They are also much less expensive to keep lit because a normal filaments loose lots of energy, to heat the filament.

To flash an LED at a given rate, on-off, on-off, is the seed of all programming, as it indicates your ability to change the value of an output gate on the Basic Stamp. This is exciting, and the first step to being able to control much larger devices like motors, lamps, and actuators of all sorts.