Getting Started With Arduino Example 06B

Hi all, I am brand new to the forum and to arduino. I am currently and quite successfully working my way through Make's Getting Started With Arduino book until now. I am on example 06B and I am having difficulty with setting up the circuit. Based on the sketch it is an analog setup but the book says to set up the LED circuit based on figure 5-4 which uses the digital pin 9.

Can anyone give me direction on how to properly set up this circuit?

Thanks!

Hi Jeffu,

Congratulations on your new toy!

The sketch uses pin 9, which is a PWM pin to simulate an analog output. The code and figure are correct.

Keep going! You're more than 1/2 way done now!

Pat.

I don't have the book, so I'm taking a wild guess here.....

Digital pin 9 is a PWM (Pulse Width Modulation) pin. PWM is the pseudo setting of analog output voltage by switching a digital pin off and on very quickly. The % of time it's on, defines the voltage. A digital pin is 5v when it's on, so if it was on and off 50% of the time it would seem as if it was only 2.5v although it's only ever actually 0 or 5.

So in a nutshell, PWM on a digital pin makes output which seems to be analog, ie between 0 and 5....

Thanks for the help! It makes much more sense now!

Hey jeffu, hows the book helping you understand arduino? Im neew to arduino also so im debating ordering this book also.

All- I highly recommend the "Arduino Cookbook." It has a lot of excellent circuit and sketch examples that range from beginner to advanced. You may not need to hack a Wii Nunchuck, but you may someday! Anyway, even if you don't, it's very cool to see how to do it.

jdmkid: Hey jeffu, hows the book helping you understand arduino? Im neew to arduino also so im debating ordering this book also.

It has taught me more than I thought. You'll learn about the basics in the hardware and software. Then you get to see it in action with simple LED circuits. Definitely worth getting.

I recommend that you type out the sketches instead of copying and pasting. That has helped me a lot.

patduino: All- I highly recommend the "Arduino Cookbook." It has a lot of excellent circuit and sketch examples that range from beginner to advanced. You may not need to hack a Wii Nunchuck, but you may someday! Anyway, even if you don't, it's very cool to see how to do it.

Thanks for the recommendation! That'll definitely be my next book.

jeffu:

jdmkid: Hey jeffu, hows the book helping you understand arduino? Im neew to arduino also so im debating ordering this book also.

It has taught me more than I thought. You'll learn about the basics in the hardware and software. Then you get to see it in action with simple LED circuits. Definitely worth getting.

I recommend that you type out the sketches instead of copying and pasting. That has helped me a lot.

Perfect thanks man! guess ill be ordering this, and the cookbook.

wait, did you order the starter kit for arduino?

jdmkid: wait, did you order the starter kit for arduino?

I bought the Make Getting Started With Arduino Kit which included Uno and I bought the book as well.

jeffu:

jdmkid: wait, did you order the starter kit for arduino?

I bought the Make Getting Started With Arduino Kit which included Uno and I bought the book as well.

Alright i bought the kit from adafruit and bought the ebook for the cookbook and the book you have.