文档介绍:Spooky Projects
Introduction to Microcontrollers with Arduino
Class 2
14 Oct 2006 - machineproject - Tod E. Kurt
What’s for Today
• Reading buttons
• Reading analog values (knobs and photocells)
• Detecting the dark
• plex LED circuits
Also, any questions about last week?
Or about stuff on the Arduino site?
Recap: Blinky LED
Recap: Programming
pile
Reset Upload
Known Good
Configuration
Rule #1 of experimenting:
Before trying anything new,
Get back to a known working state
So let’s spend a few minutes & get “led_blink” working again
Get your entire edit->compile->upload->run working
Even if it es so second nature to you that you feel you shouldn’t need to, do it anyway.
Especially when mysterious problems arise, revert to a known state
LED Light Tubes
Snug-fit straws on
the end of your
LEDs to make
them glow more
visibly
I have a box of multi-colored straws for whatever color LED you like
Digital Input
Most inputs you’ll use are variations on switches
Switches make or break a connection
knife switch toggle switch
(SPST) (SPDT)
Fundamentally, they’re all like the simple knife switch
Single pole = only one circuit is being controlled
Double pole = two circuits are being controlled at once
Single throw = only one path for circuit
Double throw = two potential paths for circuit
Many Kinds of Switches
ic hexidecimal tilt lever
Tilt sensor has a little ball inside you can hear.
Used to have mercury switches, with real metallic mercury inside. Not so much now tho’.
ic reed switches are cool, but delicate.
The hex switch is actually many switches in one, and outputs 4 signals
Tiny Switches
“gap”
connect
when
pushed
always connected together
Pressing the button, “closes the gap”
These are the switches in your kit. One should have a slightly diferent button on it than the other.
Make Your Own
Switches
• Anything that makes a connection
• Wires, tin foil, tinfoil balls, ball bearings
•