[Fritzing or photo of final main circuit for this lesson] Fritzing parts here: https://github.com/digistump/OakCore/issues/38
Description of the lesson - ex: This lesson will show you how to safely connect a Red, Green, Blue LED to your Oak and control it from a sketch.
|Oak with soldered headers||1|
|5mm RGB Common Cathod LED||1|
[NOTE: You can find an index of the parts in the starter and ultimate kits here: Starter and Ultimate Kit Parts List]
In this section you would cover the concepts new for this lesson. For this lesson that may include PWM (both what it is, how it works, and how to change it in code with tiny code examples), LEDs (briefly what they are, as the first single LED lesson should cover that more in depth), RGB LEDs (how they are different then a single LED, common cathode vs annode, etc), resistors (again in brief as the first single LED lesson should cover that more in depth).
Example of a concept:
PWM: In this lesson we will use Pulse Width Modulation (PWM) to control the 3 different color LED emitters inside the RGB LED. By powering each color from a separate pin of the Oak (through a resistor) we can use the Oak to control how much power goes to each color, which allows us to control the color of the RGB LED.
PWM can be used in your code like this:
analogWrite(0,1023); more code here...
Where analogWrite(0,1023) means turn Pin0 fully on. A value from 0-1023 can be used to turn the pin on at a level from 0-100%.
What is actually happening with PWM: PWM creates an output that averages out to a certain voltage/power level by turning the pin on and off very quickly. The setting you set of 0-100% (0-1023) is called the duty cycle, at 100% the pin remains on 100% of the time, at 50% it remains on half of the time.
Etc, etc, diagrams and images are welcome but each concept should be no more than two short paragraphs and a code block or image.
[Fritzing diagram of hooking the Oak to the RGB LED with resistors and the breadboard]
Steps to make these connections, things to watch out for (polarity, resistor codes etc)
Code to show example of it working
Explanation of code
Where to go from here, potential uses, etc.