User Tools

Site Tools


tutorials:learn:arduino:lesson3.html

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorials:learn:arduino:lesson3.html [2010/10/22 14:46]
daigo
tutorials:learn:arduino:lesson3.html [2016/01/28 18:05] (current)
Line 12: Line 12:
 |{{  http://​www.ladyada.net/​images/​parts/​clear5mmled_t.jpg?​nolink&​200x85 ​ |}}| \\ LEDs \\ For this lesson, a red, green and blue LED are best. Make sure you get a "​5mm"​ or "​3mm"​ LED, with two legs, as shown in the example image. "​Ultrabright"​ LEDs (1000 mcd rating or higher) are preferred \\ |Any electronics supply store | |{{  http://​www.ladyada.net/​images/​parts/​clear5mmled_t.jpg?​nolink&​200x85 ​ |}}| \\ LEDs \\ For this lesson, a red, green and blue LED are best. Make sure you get a "​5mm"​ or "​3mm"​ LED, with two legs, as shown in the example image. "​Ultrabright"​ LEDs (1000 mcd rating or higher) are preferred \\ |Any electronics supply store |
 |{{ http://​www.ladyada.net/​images/​parts/​resleft_t.gif?​nolink&​61x87 |}}{{ http://​www.ladyada.net/​images/​parts/​rBrown_t.gif?​nolink&​10x87 |}}{{ http://​www.ladyada.net/​images/​parts/​rBlack_t.gif?​nolink&​10x87 |}}{{ http://​www.ladyada.net/​images/​parts/​rRed_t.gif?​nolink&​10x87 |}}{{ http://​www.ladyada.net/​images/​parts/​spacer_t.gif?​nolink&​8x87 |}}{{ http://​www.ladyada.net/​images/​parts/​rGold_t.gif?​nolink&​10x87 |}}{{ http://​www.ladyada.net/​images/​parts/​resright_t.gif?​nolink&​66x87 |}}|Three 1KΩ Resistors (brown black red gold) \\ Any values from 300 Ω to 2KΩ are probably OK. | \\ Any electronics supply store  \\ $1 \\ | |{{ http://​www.ladyada.net/​images/​parts/​resleft_t.gif?​nolink&​61x87 |}}{{ http://​www.ladyada.net/​images/​parts/​rBrown_t.gif?​nolink&​10x87 |}}{{ http://​www.ladyada.net/​images/​parts/​rBlack_t.gif?​nolink&​10x87 |}}{{ http://​www.ladyada.net/​images/​parts/​rRed_t.gif?​nolink&​10x87 |}}{{ http://​www.ladyada.net/​images/​parts/​spacer_t.gif?​nolink&​8x87 |}}{{ http://​www.ladyada.net/​images/​parts/​rGold_t.gif?​nolink&​10x87 |}}{{ http://​www.ladyada.net/​images/​parts/​resright_t.gif?​nolink&​66x87 |}}|Three 1KΩ Resistors (brown black red gold) \\ Any values from 300 Ω to 2KΩ are probably OK. | \\ Any electronics supply store  \\ $1 \\ |
-|{{  http://​www.ladyada.net/​images/​pshield/​miniproto_t.jpg?​nolink&​339x250 ​ |}}|Arduino Prototyping Shield with tiny breadboard ​ \\         | \\ [[http://​www.adafruit.com/​index.php?​main_page=product_info&​cPath=17&​products_id=51|Adafruit ​\\ ]]$15 \\ + \\ [[http://​www.adafruit.com/​index.php?​main_page=product_info&​cPath=18&​products_id=65|Adafruit]]$7.50 \\ |+|{{  http://​www.ladyada.net/​images/​pshield/​miniproto_t.jpg?​nolink&​339x250 ​ |}}|Arduino Prototyping Shield with tiny breadboard ​ \\         | \\ [[http://​www.adafruit.com/​index.php?​main_page=product_info&​cPath=17&​products_id=51|Adafruit]]$15 \\ + \\ [[http://​www.adafruit.com/​index.php?​main_page=product_info&​cPath=18&​products_id=65|Adafruit]]$7.50 \\ |
 |[[http://​www.ladyada.net/​images/​parts/​breadboard-half.jpg|{{ ​ http://​www.ladyada.net/​images/​parts/​breadboard-half.jpg?​nolink&​332x241 ​ |}}]] | \\ Standard solderless breadboard ​ \\ If you dont have a protoshield,​ this is a substitute| \\ [[http://​www.adafruit.com/​index.php?​main_page=product_info&​cPath=18&​products_id=64|Adafruit]] \\ $5 \\ Many hobby shops and electronics stores will have these | |[[http://​www.ladyada.net/​images/​parts/​breadboard-half.jpg|{{ ​ http://​www.ladyada.net/​images/​parts/​breadboard-half.jpg?​nolink&​332x241 ​ |}}]] | \\ Standard solderless breadboard ​ \\ If you dont have a protoshield,​ this is a substitute| \\ [[http://​www.adafruit.com/​index.php?​main_page=product_info&​cPath=18&​products_id=64|Adafruit]] \\ $5 \\ Many hobby shops and electronics stores will have these |
 |{{  http://​www.ladyada.net/​images/​tools/​100ftsolid_t.jpg?​nolink&​150x150 ​ |}}| \\ Hookup Wire \\ Get 22  gauge solid-core wire in red, black and some other color. Make sure its //not// stranded wire! \\ |Any hardware store | |{{  http://​www.ladyada.net/​images/​tools/​100ftsolid_t.jpg?​nolink&​150x150 ​ |}}| \\ Hookup Wire \\ Get 22  gauge solid-core wire in red, black and some other color. Make sure its //not// stranded wire! \\ |Any hardware store |
Line 154: Line 154:
 Place the resistor and LED as shown. Make sure the longer leg of the LED is to the right, connected to the resistor. The resistor doesn'​t have a direction, so it doesnt matter which way it goes in.  Place the resistor and LED as shown. Make sure the longer leg of the LED is to the right, connected to the resistor. The resistor doesn'​t have a direction, so it doesnt matter which way it goes in. 
  
-[[http://​www.ladyada.net/​images/​arduino/​basicshieldled.jpg|{{ ​ http://​www.ladyada.net/​images/​arduino/​basicshieldled_t.jpg?​nolink&​500x375 ​ |}}]] \\ //Click for a high resolution photo if necessary!//​+[[http://​www.ladyada.net/​images/​arduino/​basicshieldled.jpg|{{ ​ http://​www.ladyada.net/​images/​arduino/​basicshieldled_t.jpg?​nolink&​500x375 ​ |}}]]  
 +<class center>//Click for a high resolution photo if necessary!//​</​class>​
  
  
Line 174: Line 175:
   *Try another LED in case this one is damaged   *Try another LED in case this one is damaged
   *Make sure the parts are as shown in the image above, if you have a wire in one row and the resistor in the other, they aren't connected and it wont work!  ​   *Make sure the parts are as shown in the image above, if you have a wire in one row and the resistor in the other, they aren't connected and it wont work!  ​
 +
 ==== Scheming schematic ​ ==== ==== Scheming schematic ​ ====
  
Line 187: Line 189:
 Each electronic component has a schematic symbol, which is a simplified drawing of the part. For resistors the symbol looks like this: Each electronic component has a schematic symbol, which is a simplified drawing of the part. For resistors the symbol looks like this:
  
-{{  http://​www.ladyada.net/​images/​arduino/​resistorsymbol.jpg?​nolink&​221x64 ​ |}} \\ //Resistor symbol// ​+{{  http://​www.ladyada.net/​images/​arduino/​resistorsymbol.jpg?​nolink&​221x64 ​ |}}  
 +<class center>//Resistor symbol// ​</​class>​
  
  
Line 193: Line 196:
 And the symbol for LED's look like this: And the symbol for LED's look like this:
  
-{{  http://​www.ladyada.net/​images/​arduino/​ledsymbol.jpg?​nolink&​217x78 ​ |}} \\ //LED symbol, positive pin on the left, negative pin on the right //+{{  http://​www.ladyada.net/​images/​arduino/​ledsymbol.jpg?​nolink&​217x78 ​ |}} 
 +<class center>//LED symbol, positive pin on the left, negative pin on the right //</​class>​
  
  
Line 203: Line 207:
 Power and ground also have symbols: Power and ground also have symbols:
  
-{{ http://​www.ladyada.net/​images/​arduino/​powergndsym.jpg?​nolink&​139x87 |}} \\ //Power and Ground symbols // +{{ http://​www.ladyada.net/​images/​arduino/​powergndsym.jpg?​nolink&​139x87 |}}  
 +<class center> ​//Power and Ground symbols // </​class>​
  
  
Line 209: Line 214:
 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. ​ 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. ​
  
-{{  http://​www.ladyada.net/​images/​arduino/​lesson3sch1.jpg?​nolink&​71x260 ​ |}} \\ //A barebones schematic// ​+{{  http://​www.ladyada.net/​images/​arduino/​lesson3sch1.jpg?​nolink&​71x260 ​ |}} 
 +<class center> ​//A barebones schematic// ​</​class>​
  
  
Line 215: Line 221:
 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. 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.
  
-{{  http://​www.ladyada.net/​images/​arduino/​lesson3sch2.jpg?​nolink&​168x260 ​ |}} \\ //A well documented schematic!//​+{{  http://​www.ladyada.net/​images/​arduino/​lesson3sch2.jpg?​nolink&​168x260 ​ |}} 
 +<class center> ​//A well documented schematic!//​</​class>​
  
 For practice, try drawing your own schematic on a piece of paper. ​ For practice, try drawing your own schematic on a piece of paper. ​
Line 289: Line 296:
 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. If you have the Arduino Starter Pack they will be the three clear LEDs. You can't tell which one is which until they are lit so just build the circuit and then rearrange them if needed. ​ 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. If you have the Arduino Starter Pack they will be the three clear LEDs. You can't tell which one is which until they are lit so just build the circuit and then rearrange them if needed. ​
  
-{{  http://​www.ladyada.net/​images/​arduino/​lesson3sch7.jpg?​nolink&​399x262 ​ |}} \\ //Red, green and blue LED schematic//+{{  http://​www.ladyada.net/​images/​arduino/​lesson3sch7.jpg?​nolink&​399x262 ​ |}}  
 +<class center> ​//Red, green and blue LED schematic//</​class>​
  
 In this schematic we will have three LEDs connected to three different pins: #10, #11 and #12. In this schematic we will have three LEDs connected to three different pins: #10, #11 and #12.
Line 315: Line 323:
   digitalWrite(greenPin,​ LOW);    // sets the Green LED off   digitalWrite(greenPin,​ LOW);    // sets the Green LED off
   delay(500); ​                    // waits for half a second   delay(500); ​                    // waits for half a second
-}</​code>​//You can just copy and paste this text into your Arduino software ​window.//+}</​code>​ 
 +<class center>You can just copy and paste this text into your Arduino software ​</class>
  
 **Quick quiz** ​ \\  **Quick quiz** ​ \\ 
Line 348: Line 357:
  
  
-<class white> 
 <​code>​ <​code>​
 void loop() ​                      // run over and over again  void loop() ​                      // run over and over again 
Line 366: Line 374:
  }  }
 </​code>  ​ </​code>  ​
-</​class>​+
  
 ==== Full color adventures! ​ ==== ==== Full color adventures! ​ ====
Line 393: Line 401:
   digitalWrite(greenPin,​ LOW);    // sets the Green LED off   digitalWrite(greenPin,​ LOW);    // sets the Green LED off
   delay(500); ​                    // waits for half a second   delay(500); ​                    // waits for half a second
-}</​code>//​You can just copy and paste this text into your Arduino software window.//+}</code
 +<class center>//You can just copy and paste this text into your Arduino software window.//</​class>​
  
  
Line 421: Line 430:
  
  
-{{ http://​www.ladyada.net/​learn/​proj1/​AdditiveColorMixing.png?​nolink&​236x236 |}} \\ //A additive (light) color mixing diagram// ​    +{{ http://​www.ladyada.net/​learn/​proj1/​AdditiveColorMixing.png?​nolink&​236x236 |}}  
 +<class center>//A additive (light) color mixing diagram// ​    </​class>​
  
  ​According to this diagram, if we have both red and blue light mixed together we should get a violet light. ​     ​  ​According to this diagram, if we have both red and blue light mixed together we should get a violet light. ​     ​
/home/ladyada/public_html/wiki/data/attic/tutorials/learn/arduino/lesson3.html.1287758813.txt.gz · Last modified: 2016/01/28 18:05 (external edit)