The purpose of this experiment is to create a blinking effect by repeatedly turning the LED on and off.
Equipment:
- 1 x Yellow LED
- 1 x 330 Ohm Resistor
- 3 x Wires
- 1 x Breadboard
- 1 x Arduino Uno
- 1 x Breadboard reference sheet
Since this had been the first time building this circuit, programming with C and moreover performing an arduino project, there were many new concepts. The first segment of the project, assembly, was not hard to follow as there were a minimal number of pieces and a sheet to follow up with to make the appropriate connections on the breadboard. The task was simply placing the ends of the wires or pins, in the correct hole. See the image below of the assembled circuit.
![]() |
Ariel shot of the assembled circuit. |
The programming code was directly available on the program, however we also developed an understanding for the program that was uploaded to the circuit with the aid of the comments. First the basic operation was analyzed. The 'void setup' runs once just as the power is turned on, to setup the necessary componenets for the rest of the program. Then the LED light is turned on for one second, then off for another, on for a second, then off, and so forth. Then we looked at the functions of the individual lines. The line in the 'setup' component identified the LED pin. The loop in the rest of the program turned the light by sending a 'HIGH' voltage, 'delayed' it for 1000ms then turned it of by returning it to a ground state ('LOW'). Again the pin is delayed by 1000ms so that this becomes a constant pattern.
On the whole, it takes around 4-6 minutes to build, and 5-10 minutes to program, depending on one's level of experience.
Results
Since this is one of the simplest and most straightforward circuits in the book, we had no problems getting the LED to blink. We simply built it, made sure every part was secure, then connected and uploaded the program. It seemed like at fist it was blinking at a fast pace, but after the setup, we noted the one second delay. It was blinking perfectly until we unplugged the program. See the images below of the circuit with the LED turned on.
![]() |
The LED is turned on after being programmed. |
Tips
The only hassle with this circuit would be the resistor. Treat it with extra care, and try not to bend it unecessarily. Do not apply pressure to the very top of the resistor, instead force the resistor in using the long wire on either side. In order to avoid reinserting the resistors later in the assembly, assemble the wires first, then the LED then the resistor. Working from large pieces first, to smaller ones.
Next Steps & Associated Program Modifications
A simple next step would be changing the delay time by n, and accordingly changing the coding for the amount of time to, n x 1000. However a more advanced effect, only slightly complicated would be changing the brightness using analog components. First, the wiring has to be changed to a pin that allows analog function, such as nine. Then the coding needs to be changed. Instead of the ledpin=13, make it ledpin=9. Finally inside the loop, instead of digitalwrite (ledpin, HIGH) or LOW, type analogwrite (ledpin, b), where b is any number between 0 and 255. When b is assigned 0, the LED is off, 255 the LED is on, inbetween creates a different brightness. The time delay inbetween is optional.
int ledPin = 9; //This introduces the lead pin, which is now connected to 9
//because it has analog capabilities.
// The setup() segment below runs once when the power is turned on
void setup()
{
// The line below makes ledpin 9 an output
pinMode(ledPin, OUTPUT);
}
// the loop() segment is repeated as long as the Arduino has power
void loop()
{
analogwrite(ledPin, 255);
//Now the LED is on
delay(1000);
// wait for a second
analogwrite (ledPin, 5);
//the LED has a diffrent brightness
analogwrite (ledPin, 6);
//the LED is slightly brighter
analogwrite (ledPin, 7);
//the LED is even brighter
analogwrite (ledPin, 0);
//the LED is turned off
}
The link in references gives the information above. However the modified programming is not copied and pasted from this site!!
References
The long link is the Spark Fun Inventor's Guide online.
ReplyDelete