Introduction to Embedded Systems
Simple Circuit with LED and Resistor
\(\require{AMScd}\)
One of the simplest electronic circuits we can build is one with a light-emitting diode (LED). We need to be careful though not to connect the LED alone between the 5V and GND power pins of the Arduino Uno. The LED has little electrical resistance (small value of \(R\)) and as a result – using Ohm’s law from the Electronic Circuit Basics lesson – the electric current \(I\) would end up being very high. Such a high current would cause the LED to overheat and break (see Joule heating in the above lesson), and potentially damaging the Arduino as well.
To avoid this, we must place a resistor in series with the LED, such that the current also has to go through the resistor and therefore becomes much smaller. Using a resistor of at least 220 \(\Omega\) is sufficient to keep the current from becoming too large. If we use a larger resistor, the current will be correspondingly smaller and the LED will shine less brightly.
Electronic Circuit Diagram
The diagram below shows our electronic circuit, with LED and resistor in series, connected to the Arduino:
\begin{CD}
+ \mathrm{(VCC)} @>>> R (220\Omega) @>>> \mathrm{LED} @>>> – \mathrm{(GND)}
\end{CD}

Code (sketch.ino File)
No code is needed in the sketch.ino file for this task (other than what is in there by default), since we are not using any of the computing properties of the Arduino Uno here. We are merely using the Arduino Uno here as a voltage source, like a battery, to power our electronic circuit. Indeed, only the 5V and GND power pins of the Arduino are used.