Raspberry – LED

Introduction

In this course, we’ll look at a simple example of how to use the Raspberry Pi’s GPIOS by connecting a

LED. We’ll see how to make it flash and vary its brightness using PWM.

Here’s the circuit for connecting your LED to the Raspberry Pi:

The board has GPIOS which operate at +3.3V. We therefore use a 220 ohm resistor to limit the LED input current.

Programming

Here is the program to make the LED blink:

Here is the program to vary the brightness of the LED: