Reference Links
Topics
Programming Prior Class Pages
PM Wiki |
Main /
Sp15-Class2 Rules of Thumb for LED forward voltages (vF) (how much voltage the LED needs to go on): You can briefly turn on LEDs that have a 3vF directly from an Arduino's digital pins (5v) without damaging them. Remember, you can always test with a variable power supply. Use your multimeter in parallel with the LED. Start with the voltage turned all the way down and slowly turn the voltage up. **Don't do this if you need all of your LEDs, you might burn out one or two! When the LED is first on brightly, its close to its Vf. If the LED changes color or gets dimmer as voltage goes up, turn it down quickly! You've given it too much :) How do I know which resistor to use? Graphical Resistor Calculator
For code to use with your Arduino Circuit, first try this one to see if your button is working. *Note that to get the serial window to show up and print out your button values, you will need to click on the little magnifying glass on the upper right of the Arduino software window.
Here is the code that I wrote in class: Here is the example code that lets you toggle the LED on and off with your button. It uses millis( ); to do timing so that it doesn't toggle overly fast. See my second code example named "buttonToggleTooFast" for code that toggles too fast.
Now its time for some fun.... Lets make our own switches! Switch Lab
|