I'm still working on the modification to Project 6 that will make the LEDs behave like a bouncing ball (see page 58), but so far I haven't figured out the proper code yet. (Please don't tell me - yet - as I want to try and figure this out on my own.)
In the meantime, I've moved on to Project 7 here which uses a bit of my least-favorite subject in high school - trigonometry. (Sorry math-teachers... I loved Algebra, Geometry, and Calculus, but Trig was my kryptonite...)
Project 7 calls for a single LED, but I thought it'd be fun to throw a few extra in the mix so I wired it up with 3 LEDs - green, red, and yellow. I also modified the code by adding in some additional variables (yes, I could have used an array and a loop for assigning the pins to OUTPUT mode, but with only 3 LEDs it was just as fast to create 3 variables and copy-and-paste some of the original code).
I also got to use my new mini-breadboard and the flexible jumper wires I ordered from makershed.com last week. The MakerShield is very cool but it's a DIY device, so I'll be soldering this weekend to get it operational and ready to use... will post pics when done.
Below is a video of the pulsating LEDs... the text calls for a green LED but I found the green LED gave me the worst results... the red and yellow LEDs have a very nice fade in and out and the green one just looks weak (your results may vary). Could be a cheap LED... who knows?
I think the key concept to take from this project is to understand PWM (and how the sine function is used in the code...). I got lucky in the sense that I wired up my 3 LEDs using pins 9, 10, and 11... I didn't realize that the PWM pins were limited to 3, 5, 6, 9, 10 & 11. If I had used 10, 11, and 12, I doubt I'd have gotten the results I wanted. (As a matter of fact, I'm going to pause here and rerun the project and change the code to use pin 12 for the yellow LED... let's see what happens... 2nd video will show the results.)