1. Introduction
  2. Preparations
  3. Component Introduction
  4. Connection
  5. Upload Sketch
  6. Program Running Result


In this lesson, we will show how to use different resistor to change the brightness of an LED.




Arduino IDE (version 1.6.4+)

Component Introduction


A breadboard is a rectangular plastic board with a bunch of tiny holes in it. These holes let you easily insert electronic components to prototype (meaning to build and test an early version of) an electronic circuit, like this one with a battery, switch, resistor, and an LED (light-emitting diode).

The connections are not permanent, so it is easy to remove a component if you make a mistake, or just start over and do a new project. This makes breadboards great for beginners who are new to electronics. You can use breadboards to make all sorts of fun electronics projects.

Remember that the inside of the breadboard is made up of sets of five metal clips. This means that each set of five holes forming a half-row (columns A–E or columns F–J) is electrically connected. For example, that means hole A1 is electrically connected to holes B1, C1, D1, and E1. It is not connected to hole A2, because that hole is in a different row, with a separate set of metal clips. It is also not connected to holes F1, G1, H1, I1, or J1, because they are on the other "half" of the breadboard—the clips are not connected across the gap in the middle (to learn about the gap in the middle of the breadboard, see the Advanced section). Unlike all the main breadboard rows, which are connected in sets of five holes, the buses typically run the entire length of the breadboard (but there are some exceptions). This image shows which holes are electrically connected in a typical half-sized breadboard, highlighted in yellow lines.

Buses on opposite sides of the breadboard are not connected to each other. Typically, to make power and ground available on both sides of the breadboard, you would connect the buses with jumper wires, like this. Make sure to connect positive to positive and negative to negative (see the section on buses if you need a reminder about which color is which).If you want to get more info about the breadboard,please check this link.


When you start to put components on your breadboard, avoid adding, removing, or changing components on a breadboard whenever the board is powered. You risk shocking yourself and damaging your components.


LEDs (that’s “ell-ee-dees”) are a particular type of diode that convert electrical energy into light. In fact, LED stands for “Light Emitting Diode.” (It does what it says on the tin!) And this is reflected in the similarity between the diode and LED schematic symbols:

In short, LEDs are like tiny lightbulbs. However, LEDs require a lot less power to light up by comparison. They’re also more energy efficient, so they don’t tend to get hot like conventional lightbulbs do (unless you’re really pumping power into them). This makes them ideal for mobile devices and other low-power applications.

LEDs have a positive side (called the anode) and a negative side (called the cathode). The metal lead for the anode is longer than the lead for the cathode. The cathode side also usually has a flat edge on the plastic part of the LED.More info about the LED please check this link.

You cannot directly connect an LED to a battery or voltage source. Firstly, because the LED has a positive and a negative lead and will not light if they are the wrong way around and secondly, an LED must be used with a resistor to limit or 'choke' the amount of current flowing through the LED - otherwise the LED could burn ou!


Resistors are electronic components which have a specific, never-changing electrical resistance. The resistor’s resistance limits the flow of electrons through a circuit.

They are passive components, meaning they only consume power (and can’t generate it). Resistors are usually added to circuits where they complement active components like op-amps, microcontrollers, and other integrated circuits. Commonly resistors are used to limit current, divide voltages, and pull-up I/O lines.We are going to use this to control how much electricity flows through the LED and therefore how brightly it shines.

The electrical resistance of a resistor is measured in ohms. The symbol for an ohm is the greek capital-omega: Ω. The (somewhat roundabout) definition of 1Ω is the resistance between two points where 1 volt (1V) of applied potential energy will push 1 ampere (1A) of current.

In this lesson, we are going to use three different values of resistor, 200Ω, 1kΩ and 10kΩ. These resistors all look the same, except that they have different colored stripes on them. These stripes tell you the value of the resistor.

The resistor color code works like this, for resistors like this with three colored stripes and then a gold stripe at one end.

Unlike LEDs, resistors do not have a positive and negative lead. They can be connected either way around.More info about resistor please check this link.


Connect up your stripboard as shown below, using the 200Ω resistor.We attach the LED to an output  pin(D2 here) of the Osoyoo Uno.


Breadboard Layout

Upload Sketch

Connect the Arduino board to your computer using the USB cable. The green power LED (labelled PWR) should go on.Open the Arduino IDE and select corresponding board type and port type for your Arduino board.

Now load the 'leds' example sketch or copy below code to your new Arduino IDE window and upload it to your arduino board. Then you will notice that the LED on the breadboard should now blink.

// We use the pin 2 to connect with the LED;. // give it a name: int led = 2; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(500); // wait for 0.5 seconds digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(500); // wait for 0.5 seconds } 

Running Result

A few seconds after the upload finishes, you should see the pin 2 LED on the breadboard start to blink as below:

With the 200 Ω resistor in place, the LED is quite bright.

Now we swap out the 200 Ω resistor for the 1k Ω resistor, then the LED appear a little dimmer:

Finally, with the 10 kΩ resistor in place, the LED is quite faint: