in black and white
Main menu
Home About us Share a book
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics

Electronics for dummies - McComb G.

McComb G., Boes E. Electronics for dummies - Wiley publishing, 2005. - 433 p.
ISBN: 0-7645-7660-7
Download (direct link): electronicsfordummies2005.pdf
Previous << 1 .. 107 108 109 110 111 112 < 113 > 114 115 116 117 118 119 .. 149 >> Next

Line 2: OUTPUT 0 tells the BASIC Stamp to use I/O pin 0 as an output. You should have the LED connected to I/O pin 0 (if you dont, be sure to go through the steps in the section Getting to Know the BASIC Stamp 2 earlier in this chapter).
TERM LinG - LIVE, InfDrmatlVE, NDn-CD5t and 1 !
298 Part V: A Plethora of Projects_
^ Line 3: This line, which reads btn VAR Byte, tells the BASIC Stamp to set aside a little bit of memory for a variable named btn. A variable is a temporary holding area for data. After the variable has been created, the BASIC Stamp can stuff data into it and then later come back and check to see whats in it.
Line 4: The line loop: sets up a repeating loop, exactly as in the LED example in the section Step 2: Programming the darned thing earlier in this chapter.
Line 5: This line starts with the BUTTON programming statement and tells the BASIC Stamp to check the state of the switch connected to I/O pin 1. The BUTTON statement requires a bunch of additional options, which you can find in the BASIC Stamp documentation that came with your BASIC Stamp kit.
^ Lines 6 through 8: These lines turn the LED on, tell the BASIC Stamp to wait 150 milliseconds, and then extinguish the LED again.
^ Line 9: Tells the BASIC Stamp to repeat itself, starting from the loop: label. This repeat goes on forever or until you unplug the BASIC Stamp or upload a new program.
See the noSwitch label in lines 5 and 9? When used with the BUTTON statement (as in Line 5), this label creates what is known as a branch. Should the switch not be depressed (the noSwitch part of the code), the BASIC Stamp jumps from the BUTTON statement line and goes all the way down to the last line, missing all the instructions for lighting the LED. But if the switch is depressed, the BASIC Stamp performs all the steps.
Heres what should happen when you run the program:
^ When the switch isnt depressed, the LED stays off.
^ When the switch is depressed, the LED blinks on briefly, and then turns off again.
Uh oh! If your BASIC Stamp doesnt respond this way, double-check how you have everything wired together, and verify that you typed the program in exactly as you see it in this section.
Where to Go from Here
This chapter touches on just the basics of the BASIC Stamp. You can find a whole lot more to do with the BASIC Stamp, or any other microcontroller that you want to try, for that matter. Check your neighborhood bookstore for references on using microcontrollers. Try Google or another online search engine to browse for goodies about your microcontroller of choice.
term LinG - live, informative, Non-cost and Genuine !
Chapter 14
Great Projects You Can Build in 30 Minutes or Less
In This Chapter
> Stocking up on project supplies
> Creating unique light blinkers and flashers
> Exploring the smashing personality of piezoelectrics
> Seeing in the dark with an infrared sensor
> Rigging a couple of alarms
> Finding your way with your very own portable electronic compass
> Creating your own amplifier
> Testing for water
etting up to speed on electronics really pays off when you get to the point where you can actually build a project or two. In this chapter, you get to play with several fun, entertaining, and educational electronics gadgets that you can build in half an hour or less. We selected the projects for their high cool factor and their simplicity. We've kept parts to a minimum, and the most expensive project costs under $15 or so to build.
We've given you some detailed procedures for the first project, so work through that first. Then, you should be able to follow the circuit schematics and build the rest of the projects on your own. Check back to Chapters 6 and 7 if you need a little help reading or understanding the schematics.
term LinG - live, informative, NDn-cDst and Genuine !
300 Part V: A Plethora of Projects
Getting What You Need Right Off the Bat
You can build all the projects in this chapter, except for the electronic compass, on a solderless breadboard. Of course, feel free to build any of the projects on a regular soldered circuit board, if you want to keep them around.
We cover all the parts you use in these projects, such as transistors, integrated circuits, capacitors, and even wire in Chapters 4 and 5. Theres more detail about breadboarding and building circuits in Chapters 11 and 12. If you get stuck on any of these projects, hop to one of those chapters to help you through.
With one exception (that pesky but worthwhile electronic compass project, again), you can find the parts that you need to construct the projects in this chapter at any electronics store or online retailer. If you dont have a well-stocked electronics outlet near you, check out both Chapter 17 and the Appendix for some mail-order electronics parts suppliers.
Unless we tell you otherwise:
All resistors are rated for X or watt and 5 percent or 10 percent tolerance.
All capacitors are rated at a minimum of 25 volts. We note the type of capacitor that you need (disc, electrolytic, or tantalum) in the parts list for each project.
Previous << 1 .. 107 108 109 110 111 112 < 113 > 114 115 116 117 118 119 .. 149 >> Next