Schematic of the circuit.
This is a diagram of what the circuit should look like when finished. It also shows where all the components are placed.Â
Since Arduino measures time in milliseconds, a delay of 1000 is equal to one second. We shortened the delay in the code from 1000ms to 50ms to have the blink be barely visible. "HIGH" turns on the LED and "LOW" turns it off. This code here means that the light is on for 50 milliseconds before turning off for 500 milliseconds.
The potentiometer connects directly to the 5V pin.
The potentiometer works as a resistor that can be manually changed to allow more or less voltage into the circuit. As seen in the GIF above, turning the knob on the potentiometer changes the speed at which the LED blinks.
The RGB LED connects to three different pins which corresponds to the red light, green light, and blue light.
Process
The LED individually activates the red, green, and blue pins before cycling through the entire spectrum of colors, the showSpectrum function.
The showSpectrum function cycles through different colors by modifying the value of each of the three pins of the RGB LED separately from each other. This creates a mix that when ran by the showSpectrum function, displays the entire spectrum of colors. It is split up into three zones corresponding to the three LED pins.
This circuit has eight different LED's, each of which connects to its own pin and has its own resistor.
Process
The two slashes (//) tells us that the line of code is a comment and that it is overlooked by the Arduino. Removing the slashes calls it as a function which is written below. The pingPong function activates each light in sequence before reversing and lighting up the LED's in the opposite direction. The marquee function lights two LED's and leaves a gap between them.
The photo resistor does exactly what the name suggests, changes resistance based on how much light it receives. As I cover the photo resistor, the LED shines brighter because it interprets less light reaching the resistor as a darker environment.
Process
The manualTune function makes you manually adjust the range that the photo resistor can output, limiting the range of brightness for the LED.
The autoTune function allows the Arduino to keep track of the values from the photo resistor and will automatically restrict current to the LED with full range, allowing for a wider range of brightness.