Raspberry Pi Controlling LED’s Via GPIO

The aim of this exercise is to instruct students how to program the GPIO pins on the Raspberry Pi as digital outputs. The GPIO pins will be used to control some LEDs and a seven segment LED display.

The Raspberry Pi has a number of General Purpose Input Output (GPIO) pins which can be programmed as DIGITAL inputs or outputs. Digital inputs and outputs can only ever be “ON” (digital state “1”) or “OFF” (digital state “0”). In this exercise, you will program the Raspberry Pi’s GPIO pins to control some LEDs.

The GPIO pins are located at one corner of the Raspberry Pi, as shown below. There are 26 pins in all, and they are used for a variety of different things. It isn’t important to remember what all the pins do, but it is important to note how they are numbered.

These exercises include a set of Student exercises with additional Teachers notes (see attached files)

raspberry-pi-controlling-leds-via-gpio

Learning Objectives

The exercise is split in to three “Steps” of increasing complexity

Step 1 introduces the student to the IDLE integrated development environment and to the Python programming language by asking them to enter commands directly at the Python prompt. It was also necessary to introduce the concept of “user privileges” under the Linux operating system, although this is really beyond the scope of the exercise.

Step 2 introduces the concept of creating a file containing a series of Python commands, saving this file as a “computer program”, and “running” the program. The concept of compiler warning and error messages, and the usefulness of such messages, is also introduced.

Read More: Raspberry Pi Controlling LED's Via GPIO

 


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top