It means the LED will work properly if we pass around 15mA current through it. The voltage we are going to use is the voltage of the Arduino pin, which is 5 volts minus the voltage drop of LED, which is around 1.
So the voltage will be around 3. But, the output pin has been stressed and will some day cause problems and then, the question is why? That number in the data sheet does not describe the short circuit current, which isn't specified. It describes the absolute maximum allowable current. Notice that output voltages are specified at 20 mA. LEDs are mostly cheap enough to be expendable. Not always so, is the Arduino. But it's really about learning to design things you can be confident will continue to work.
The output FETs on ATmega pads that means the part of the chip connected to a pin are about 30 to 40 ohms when on. Use ohms in series with a pin and you limit the max current to under 30mA for 5V supply into a shorted output. You can routinely use such protection resistors on outputs if you want I think the Ruggeduino takes this approach? The principle reason for the abs max current rating is that the output transistors will overheat and be destroyed - they are tiny on-chip transistors and can only take about 50mW by my calculations.
But a better way is to draw a wiring diagram. Then it wouldn't matter if your camera wasn't very good. A wiring diagram is also known as a schematic. Schematics are the standard method for people to trade information about circuits.
Being able to read and write schematics is a key skill! Here is a schematic for a really big project, a Roland TB synthesizer clone.
Each electronic component has a schematic symbol, which is a simplified drawing of the part. For resistors the symbol looks like this:.
Resistor symbol. LED symbol, positive pin on the left, negative pin on the right. You can see that the resistor symbol is symmetric, just like resistors themselves. The LED symbol, however, has an arrow thing going on.
This is the direction in which current flows. The little arrows that are coming out of the symbol indicate that this is a diode that emits light. Power and Ground symbols. The only thing we need to do now is indicate how the LED and resistor are hooked up and show the 5V and ground connections.
A barebones schematic. Next to symbols, we often write important information like what the resistor value is, what color and size the LED should be, and the voltage associated with the power supply. A well documented schematic! Before you change your breadboard, make a guess of what will happen: Will the LED stay lit?
Will the LED go out? Something else? Now make the change to your breadboard:. You will notice that, in fact, the LED has gone out. That is because it is no longer connected to a power source and current is not flowing. If you were very fast at it, you could make the LED blink! Start up the Arduino software again and open up the MyBlink sketch from lesson 2. If you left it with delay times of 10ms, you may want to modify it so its back to ms on and ms off.
Upload the sketch to your Arduino. Now change your breadboard wiring so that it matches this schematic. That is, instead of connecting the resistor to 5V or ground, connect it to the Arduino pin socket labeled You should see the LED turn on and off. Lets look at that code again. You may want to think about how cool it is for a few moments. The LED isn't be blinking anymore!
Lets fix it! Go back to the beginning of the sketch and find this line again. This is the line of code that indicates which pin is connected to the LED. Change it so that it is now connected to pin Re-compile and verify the sketch, then send it over the the Arduino. The LED should now be blinking again. Thats because its connected to pin 13 only! OK sure you've had plenty of practice messing around with LEDs. It's time to go full color! Find a red, green and blue LED.
You can't tell which one is which until they are lit so just build the circuit and then rearrange them if needed. Red, green and blue LED schematic. In this schematic we will have three LEDs connected to three different pins: 10, 11 and Quick quiz What does this sketch do? Compile and upload the sketch to test your hypothesis. Highlight the text below to see the answer It blinks the two LEDs connected to pins 11 and 12 at the same time. Step 1. Add the line of code that will create a variable called bluePin.
What pin should it be assigned? Examine the schematic above to find out. Step 2. Add the line of code that will tell the Arduino that bluePin is a digital output.
Step 3. Compile and verify your code. Does it work? If not use your debugging skills to figure out what is wrong and fix it! Now that you have red, green and blue light, you can start having fun with color mixing.
0コメント