|
このページはEtoJ逐語翻訳フィルタによって翻訳生成されました。 |
This page covers the simple 事例/患者 of 運動ing LEDs 直接/まっすぐに with Arduino pins. The same (警察などへの)密告,告訴(状) would be helpful to 使用者s of PICs and other sources of 数字表示式の 生産(高) lines. It does not go into the more 利益/興味ing 事柄 of multiplexed LEDs.
The に引き続いて shows you how to connect an LED to an Arduino....
Don't (yet!) worry about the dotted lines or the circles with V in them.
You connect an LED as shown in the diagram: From Arduino 数字表示式の pin to one 脚 of LED. From other 脚 of LED to one 脚 of resistor. From other 脚 of resistor to "ground", i.e. to the "消極的な", or "無" 味方する of 力/強力にする 供給(する) on your Arduino. (One of it's pins is 示すd "0" or "ground" or "gnd", depending on which board you have.)
平易な! (When you know how)
First of all: 力/強力にする: the normal 1/4 ワット resistor is more than enough, as far as that parameter is 関心d. Eighth ワット would be okay too, but they tend to be a bit 壊れやすい 肉体的に.
Second: What value, how many ohms?
I 一般に use between 330 and 680 ohms. Too big a resistor and the LED just won't glow at all. Nearly too big and it is 薄暗い. Too small and either you will 燃やす out the LED, or worse, your Arduino, or at least the 回路・連盟s of one pin of it. Also, be advised: Different colors and designs of LEDs need different 抵抗s.
So... let's be a little more rigorous about what is "権利".
You should not let more than 40mA flow through any of your Arduino's 数字表示式の or analog signal pins.
And although I 港/避難所't 設立する the 人物/姿/数字 yet, I 嫌疑者,容疑者/疑う there's a 限界 for the 装置 全体にわたる. In other words, it would probably be a Bad Idea to have all 20 pins operating at 40mA all at the same time. for a total of 800mA. (20? The 14 "数字表示式の" pins, 加える the 6 that are 普通は for analog or PWM work, but can be used as 数字表示式の pins, if you wish to use them that way.)
When you've 始める,決める one of the pins up as an 生産(高), and 始める,決める it "high" (we'll go into the 詳細(に述べる)s later), it is almost as if the pin is connected to the 5v 味方する of your 力/強力にする 供給(する). So, if in 疑問, connect what you are going to connect to a pin to 5v and see how it behaves. If something is wrong, your Arduino won't be 伴う/関わるd!
You probably heard of Mr. Ohms' 法律? From that, we would 結論する that the smallest 安全な resistor would be 125 ohms.... and indeed if your resistor was 125 ohms, the 40mA wouldn't be 越えるd. However, the LED introduces a "抵抗" (of sorts), so in fact, you could use an even smaller resistor if you 手配中の,お尋ね者 40mA flowing through the LED. Most LEDs 達成する their 最大限 brightness before 40mA, and I wouldn't be surprised if some 燃やすd out if that much 現在の flowed through them.
If you know the "訂正する" 現在の for your LED, you go about working out the value for the resistor as follows.....
Besides giving you the "訂正する" 現在の for your LED, the specs will also (or you can 人物/姿/数字 out... that's coming) the "voltage 減少(する)" that the LED 原因(となる)s. LEDs do not behave like resistors. Regardless, within 推論する/理由, of the 現在の flowing through them, they 原因(となる) the voltage to 少なくなる by a constant 量. (With resistors, as Mr. Ohm 公式文書,認めるd, the more 現在の there is, the more the voltage 少なくなるs, or "減少(する)s".)
This brings us to the dotted lines on the diagram above. They, and the circles with "V"s 代表する voltmeters optionally 大(公)使館員d to the 回路・連盟. When the voltmeter's leads are 大(公)使館員d either 味方する of the LED, as show for "V1" in the diagram, within the normal operating 範囲 of the LED, the voltmeter will read the same 量, 関わりなく the 現在の. the green LED I have on my Arduino at the moment gives rise to a 1.8v 減少(する). The 残り/休憩(する) of the voltage coming from the pin will 減少(する) across the resistor, so V2 "should" read 3.2, if the pin is 配達するing a 十分な 5v. In actual fact it may be a little いっそう少なく than that... but if I do my 計算/見積り based on the 抵抗 I need to make the 現在の I want, if the voltage is 3.2, then I'll have a safety 利ざや in the 不足(高) from 5v 配達するd by the pin.
So what's all this about the LED not behaving like a resistor? If you were to connect the same LED and resistor across a 10v 供給(する), instead of the LED taking 1.8 fifths of the voltage, and the resistor 3.8 fifths of it, the LED would still be dropping the voltage by 1.8 volts, and the resistor would be "using up" (dropping) the remaining 8.2 volts... i.e. "taking a bigger 株" than before. Had you used two resistors, of suitable values, they would continue to "株" the dropping of the voltage in the same 割合 as before.
If you want the 詳細(に述べる)s of how to calculate how big the LED's 現在の 限界ing resistor せねばならない be, click the link.
Yes: It 事柄s. But No: It won't 傷つける anything if you put the LED in "backwards".... the LED just won't light up.
Try it one way. If it doesn't light, try it the other. If it doesn't light that way either, put your voltmeter on the 数字表示式の pin that is supposed to be turning the LED on. If it isn't producing a voltage, then there's probably an error in your program. 直す/買収する,八百長をする that; get a voltage on the pin, then try 挿入するing the LED again. Or, instead of connecting the "upper" 脚 of the LED to the Arduino, connect it to 5v. (Do NOT connect the 数字表示式の pin AND the upper 脚 of the LED to 5v... if the 数字表示式の pin is configured as an 生産(高) in the "low" 明言する/公表する, connecting that to 5v would Not Be Good.)
I have once 遭遇(する)d LEDs with a "built in" resistor. Convenient, but not very 柔軟な.
Forget the resistor and a large 現在の will flow... and likely 損失 LED or Arduino or both... but you may get away with it. Don't try it to see, though!
The "Blink" program which comes with the Arduino 開発 program is a 罰金 way to 実験(する) you have your LED 適切に connected. Just be sure to connect your LED and resistor to pin 13 if you are using "Blink" 完全に unmodified.
Here's a really simple program to 実験(する) LED 関係s. It is not a "good" program, but it is stripped 負かす/撃墜する as far as it can be, for the sake of 簡単.
無効の 体制/機構()
{
pinMode(12, OUTPUT);
}
無効の 宙返り飛行()
{
digitalWrite(12, HIGH);
延期する(500);
digitalWrite(12, LOW);
延期する(500);
}
That program will make an LED on pin 12 blink. To change it for an LED on a different pin, you have to change three instances of "12". (That's one of the things that makes the program above 不正に Written. With just a little programming savvy, you would 令状.....
#define ledPin 12 //no ; here
無効の 体制/機構()
{
pinMode(ledPin, OUTPUT);
}
無効の 宙返り飛行()
{
digitalWrite(ledPin, HIGH);
延期する(500);
digitalWrite(ledPin, LOW);
延期する(500);
}
Written that way, you only have to change one 12, the one in the first line, to "re-令状" the program so that it will wink an LED on a different pin.
Using the techniques above, you can turn on or off up to 16 LEDs and up to 20 if you decide to use the Arduino's analog pins for 数字表示式の 生産(高)s, which you can do.
However, with a few bits of 外部の electronics, and/ or more clever programming, you can 支配(する)/統制する many, many more LEDs. (Or lots, with just a few pins... 9 LEDs with 6 pins, or 16 with 8). That is the story of multiplexing, which is a story for another time!
The 公式の/役人 Arduino pages on the web 申し込む/申し出 (警察などへの)密告,告訴(状) about multiplexing.. See also, the "生産(高): Light and 陳列する,発揮するs" section of the 公式の/役人 Arduino page about 事業/計画(する)s.
I hope you 設立する the above answered your questions?
I also 申し込む/申し出 a page with 詳細(に述べる)s of how to calculate how big the LED's 現在の 限界ing resistor せねばならない be, and a "Connecting LEDs for Beginners" page talking about connecting to all sort of things, e.g. a Windows computer 平行の port.
If you visit 1&1's 場所/位置 from here, it helps me. They host my website, and I wouldn't put this link up for them if I wasn't happy with their service.
Click here to visit editor's Sheepdog ソフトウェア (tm) freeware, shareware pages.
Click here to visit the homepage of my biggest 場所/位置.
Click here to visit the homepage of Sheepdogsoftware.co.uk. 陳謝s if the "?FrmAht" I 追加するd to that link 原因(となる)s your browser problems. Please let me know, if so?
Page 実験(する)d for 同意/服従 with INDUSTRY (not MS-only) 基準s, using the 解放する/自由な, 公然と accessible validator at validator.w3.org
....... P a g e . . . E n d s .....