Hardware Reference
In-Depth Information
he number 0xf is simply a byte with all bits set to one. his notation is called hexadecimal and
believe it or not is simpler to think about than decimal when it comes to creating bit patterns.
he faster and slower control boxes change the value to add to the nextTime variable. here
are also some checks which stop the value from going below zero. Finally the last control
changes the variable that determines where the sequence advance is coming from. In order to
inform you where the advance trigger is coming from the text in this control box is changed
when you click it. Figure 11-2 shows the sequencer as it appears on the screen.
Figure 11-2:
he sequencer
application.
Notice the structure of the code. here is a data structure in a list called seq ; it is the values
in this list that control what is displayed on the screen, and what is output to the lights. Any
changes are made to this list, and then the list is used to change the display as well as provid-
ing the output. Note that the screen display is not used to hold data - only relect it. his is
an important principle and is used whenever you try and write a nontrivial piece of code.
The Lights
he next step is to control some lights rather than the LEDs that are on the PiFace board.
While these LEDs are good for testing they are not going to be very impressive in a disco.
he bufer on the PiFace board is capable of switching voltages up to 40V with currents up to
half an amp. Now although it can do this on any output, it cannot do this on all the outputs
at the same time. hat is, there is a collective sum total of current the bufer can switch with-
out getting too hot; this is about 650mA. his works out at about 80mA per output if you are
to allow for all outputs to be on at once. What you are going to do is drive an LED strip of
each output by using a 12V external power supply. here are two types of LED strips, those
that have electronics embedded along the strip so that you can control individual lights in
the strip, and those where the whole strip lights up at the same time when you apply voltage
to it. You are going to use the latter type, which fortunately is cheaper as well.
hese LED strips can be cut up at a point every third light, and every three lights consumes
20mA. herefore you can tailor the amount of current drawn by simply cutting the appropri-
ate length of strip. Some places sell these by the meter and others by the group of three. he
Search WWH ::




Custom Search