Hardware Reference
In-Depth Information
This is fantastic! You now have all the ingredients you need to break out of the virtual
world of the Minecraft sandbox and link up the game to real-world objects. If you can
write a program that flashes an LED, you can go on to control any number of other elec-
tronic devices—you are limited only by your imagination and willingness to experiment!
CHALLENGE
Get some different coloured LEDs and wire them up to other GPIO pins on your
computer. Use a blue LED and add this to your Python program using the
getBlock() function so that if you are standing on water, it lights the blue
LED. Get a green LED and make it light up if you are standing on grass. How
many different things can you invent that turn the LEDs on when something
happens inside your Minecraft world?
Using a 7-Segment Display
Your next project in this adventure will use a very common type of LED display to
show numbers and other symbols when things happen inside Minecraft. You will also
be able to use this display in the big game in the inal adventure of this topic. Before
you link up the display to Minecraft, you first have to get the display connected and
working. Once that's done, you can link it into your Minecraft game just as easily as
you did with your flashing LED.
In this project, if you are using a PC or a Mac, you will use the anyio package.
This package is provided in the starter kit and is also downloadable from the links
listed at the start of this adventure.
What is a 7-Segment Display?
If you look around your house or go into any shop, you will see hundreds of different
products that use the 7-segment display format. Digital watches, timers on microwave
ovens, CD players, even central heating controllers, all use this pattern of seven seg-
ments. Figure 5-10 shows the distinctive pattern of a 7-segment display and also how
it is wired internally.
All 7-segment displays have a number of different LEDs in the same device. The most
common display, and the one you will use in this next project, actually has eight LEDs
inside the same component, but one of them is reserved for the decimal point in the
bottom corner of the display. Only seven of the LEDs are dedicated to the actual pat-
tern, which as Figure 5-10 shows, is in the shape of a figure eight.
 
Search WWH ::




Custom Search