LED strips are a quick, easy, simple way to get lots of color into a project.

The type we have in the Phys Comp Lab (part # 2001 in our inventory) is composed of a series of small LED modules arranged next to each other on a band of plastic. We buy them on Amazon. Each individual LED module has four connections:

  • power (5 Volts in this case),
  • ground,
  • “data in” (abbreviated DI), and
  • “data out” (abbreviated DO).

The plastic tape has some ebedded wires in it which connect all the LED modules on the strip to power and ground. The data in and data out work a little differently—note the little arrows on the strip:

Detail of small white arrow pointing towards right edge of LED strip.

These show the direction the data flows. The first little module on the left gets data into its left side (DI), and then processes it, and passes the data through, out its DO pin. In this way, the LED strip modules act as a little bucket brigade for the data telling each one which color to light up.

[sold on and uses the

const int BUTTONPIN = 2;

void setup(){
    pinMode(BUTTONPIN, INPUT);

void loop(){
    int buttonState;
    buttonState = digitalRead(BUTTONPIN);
    // now buttonState will be either HIGH or LOW, depending on the voltage present at pin 2.

The values HIGH and LOW can be used for the purpose of comparison. For instance:

if (buttonState == HIGH) {
    // some code that runs when the button is pressed

Switch types

We have a variety of switches available in the Physical Computing Lab, and there is a truly huge range of them out in the world. (For instance, as of this writing, Mouser sells 24,602 types of toggle switches, and Digi-Key sells 25,378 types of pushbuttons.)

Here, we review the switches included in your course kit as well as some other common types.

momentary pushbutton (“tactile” buttons)

This four-legged little button makes a nice “click” sound when you push it. It does not have the internal wiring you may expect. Here’s the button next to a schematic elucidating the wiring:

Image of small momentary tactile pushbutton, with four legs, arranged so that the legs are somewhat flattened out and all pointing to the sides (the left two legs points to the left, and the right two legs to the right). The button is on a white background, and to the right of the button a schematic shows that at all times, the upper left leg is connected to the upper right leg, and and that all times the lower left leg is connected to the lower right leg. The switching action connects the upper and lower legs to each other.

Note that the upper right and upper left legs are always connected to each other, and the lower left and lower right legs are also always connected to each other. The action of the button is to connect the upper part of the switch to the lower part of the switch.

The button is designed with spacing specificically meant to fit across the center dividing valley in a standard breadboard, like so:

Image of a pushbutton tactile switch installed in a long breadboard. The switch is installed so it is straddling the center dividing valley in the board.

Keep the switch’s surprising internal wiring in mind when using these on a breadboard—the top row of the switch will act as though the electrical row goes across the breadboard’s valley (since the inside of the switch will bridge that gap), and likewise with the bottom.

single-pole double throw switch

This type of simple switch is referred to as “single pole double throw” because there is only one “pole” that the switch operates (the center pin in this case), and that single pole has two possible connections (“throws”) it can make. It is a “maintained” switch, as opposed to “momentary,” meaning that it will remain in the last position it was pushed into (it has no internal spring unlike a momentary switch).

Image of a small one-row single-pole double-throw switch on a white surface. Its switch is positioned to the right, and so it is currenctly connecting its center pin to its right pin. A schematic diagram shows that the other possible configuration is that when the switch is to the left, it will connect the center pin to the left switch pin.

The center pin will either always connect to the left pin, or to the right pin. The left and right pin will never connect to each other, unless there’s a mechanical fault inside the switch. (Which is possible!)

micro limit switch, or micro lever switch

These small switches can be used as “limit” switches, meaning they detect when something moving in a straight line is brought into physical contact with something else in a fixed position. This position would be defined as the “travel limit” of a physical part, and it is a common operation in electronically controlled motion systems to move something along an axis until it contacts a limit switch at the end.

The switches are called “lever switches” because of the way they’re built—that arm sticking out of the switch is a small lever, and the switches come in a variety of lever length shapes and sizes to accommodate different design needs.

Image of a small switch on its side with three legs. The top of the switch is a thin metal lever which hinges on the upper left corner of the switch, and swings at about an angle of 20º above the rest of the switch body. The leftmost leg of the switch is the "common" leg; the center leg is "normally open" (i.e. normally not connected to the common), and the right leg is "normally closed" (i.e. normally connected to the common). The switch has "C", "NO", and "NC" markings in small raised letters above the legs identifying them as such.

If you look very closely, you can see the switch’s markings in raised letters on the plastic body; the legs are marked from left to right, C, NO, and NC, which mean “common,” “normally open,” and “normally closed” respectively. (“Normal” refers to when the button/lever is not being pushed.)

mini lever switch

This switch is the slightly-bigger cousin of the micro lever switch. It is more robust mechanically, and designed to fit into standardized tabbed holders in various kinds of machinery. It has a roller at the end of its arm, which means that it could be used, for instance, as a cam follower, or some other application where the motion of the thing contacting the switch wouldn’t necessarily always be perpendicular to it.

Image of a medium-sized, red lever switch on its side. The bottom metal tab of the switch, labeled "COM," is the common lead, and on the right side of the switch there are two connections. The upper right connection is labeled "NC" for normally closed, and the bottom right connection is labeled "NO" for normally open. The schematic drawing illustrating switch's operation as described is visible in the raised plastic of the part.

Note that in the case of this switch, there was enough space on the plastic housing that the manufacturer was able to draw a small, albeit legible schematic of the switch.