I'm working my way through "Getting Started with Arduino" (http://oreilly.com/catalog/9780596155520) and I'm stuck on Example #5: Using a switch to control the brightness of an LED.
I understand the code fine (I'm a developer) but I'm totally stuck trying to build the circuit for this example. Basically the book says to combine Example 4-6 (using a switch to turn an LED on/off) and Example 5-4 (LED using PWM), but I cannot figure out how to do this. The book offers no additional info on how to build this circuit, and as a complete beginner I'm totally stuck :(
Can anyone help point me in the right direction? Thanks!
I am posting screenshots from the book to help illustrate the two circuits that need to be combined. Hopefully this doesn't infringe any forum policies or copyrights
For starters, remove the LED from the first circuit. Its unnecessary on modern Arduinos as they already have an LED on pin 13, and since they no longer have an an in-line resistor on that pin, plugging an LED straight in is very likely to burn out the LED or worse the Arduino.
Then just connect the ground and pin 9 from the second circuit 'on top' of the first circuit.
Therse nothing magical about the positioning of componets on breadboards, you can build built any circuit on any part of the board.
A1, B1, C1,etc are connected togther. Each number is a seperate row.
It’s not clear what problem your actually having building the circuit? One ‘trap’ to look out for is possibly with your switch. If you don’t see any change when you press the switch you should try rotating in 90 degrees as the switch will only operate in two of the four possible mounting combinations.
@pluggy: thanks for the warning. I'll give what you suggest a shot.
@retrolefty: the problem is that basically I have no idea where to even begin :) Thanks for the advice re: the switch.
I don't know if you understand this or not... If you dont, you do the button circut but dont use that led on pin 13. only the button, 3 wires, and resistor. Then wire the pwm led circut up, and you're all set! I will draw it up, and then I can email it to you of you like.
I finished it... PM me your email if you want me to send it...