build details

Show: section status errors & todos local changes recent changes last change in-page changes feedback controls

Blinking an LED

Modified 2020-07-15 by Dev Ramesh

Modified 2020-09-11 by Dev Ramesh

Student version (unknown ref duckiesky_high_school_student/computing-pi-led)

previous warning next (18 of 36) index
warning
I will ignore this because it is an external link. 

 > I do not know what is indicated by the link '#duckiesky_high_school_student/computing-pi-led'.

Location not known more precisely.

Created by function n/a in module n/a.

Hardware -

  • Basestation

  • Build Part 1 completed

Previous lesson -

Knowledge - Definition and purpose of Raspberry Pi GPIO

Skills -

  • Read the GPIO pin chart for the Raspberry Pi

  • Write a bash script to blink their LED

Blinking an LED

STANDARDS: Next Generation Science Standards (NGSS) and International Society for Technology in Education (ISTE)

Modified 2020-07-23 by Peyton Strong

NGSS: HS - ETS1 - 2: Design a solution to a complex real-world problem by breaking it down into smaller, more manageable problems that can be solved through engineering.

ISTE: 1. d.: Understand the fundamental concepts of technology operations, demonstrate the ability to choose, use and troubleshoot current technologies and are able to transfer their knowledge to explore emerging technologies.

Assessments and Evidence of Understanding

Modified 2020-07-15 by Dev Ramesh

Students write a bash script to make the led that they’ve soldered blink.

AGENDA (Brief Summary of Activities)

Modified 2020-07-15 by Dev Ramesh

5 min: Basestation Setup

20 min: Scripts and REPLS Lesson

35 min: Writing a Bash Script

Differentiation (strategies for grouping, ELL, and inclusion)

Modified 2020-04-16 by Garrett Warren

Advanced preparation/Materials/Set Up (Including Misconceptions)

Modified 2020-08-26 by unknown

Classroom Set Up

Teacher can write a DO NOW on the board for students to set up their basestations.

SCRIPT OF TEACHING AND LEARNING ACTIVITIES

Modified 2020-04-16 by Garrett Warren

Introducing The Lesson

Modified 2020-08-26 by Dannylee885

Hook

Teachers can talk about the following or their own.

  • This will be a lesson for the student on creating a bash script that will blink the LED on their drone. It is important to understand scripts as they will come up when continuing with programming.

Main Lesson

Modified 2020-09-16 by Dev Ramesh

1 - Teachers cover what a REPL (Read–eval–print loop) is and what a script is

In the bash lesson, we have already learned how to control our computer in the terminal. However, we seem to only able to type one line/command at a time. Can we do better than that? Before we discuss the possibilities, we introduce two related terminologies.

  • Read–eval–print loop: a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user.

  • Script: a programming language for a special run-time environment that automates the execution of tasks; the tasks could alternatively be executed one-by-one by a human operator.

Difference: script saves the commands to be run sequentially in the future, while the REPL runs only one command at a time. Previously in the bash lesson, all the commands you ran were executed by the REPL. In this lesson, you will learn how to ‘save’ multiple commands and run them all at once in bash!

2 - Teachers speak on Pi GPIO numbering

Motivation: The goal of this lesson is to our terminal on the Pi to blink the LED soldered on your drone. LED lights up when their is electric current flows throught it. Therefore, we want to write commands that activate the pin on the Pi to provide the current. However, we need to know first how to refer to a specific pin in the terminal.

  • On the Raspberry Pi, Pin can be defined in two ways, using the GPIO Board and GPIO BCM methods.

  • GPIO Board refers to the naming on the Raspberry Pi board. This is the numbering on the Pi Hat.

  • GPIO BCM refers to the default pin of the Broadcom SOC channel chip. This is the numbering we are going to use in this lesson. We need to know how the BCM pin numbering corresponds to the numberings on the Pi Hat. Here it is.

Writing a Bash Script

Modified 2020-09-16 by Dev Ramesh

Exercise: Instructors show how to make and run bash scripts, delays, printing, pin setting by leading students write a bash script to make the led that they’ve soldered blink.

See the student book for details

Useful Resources and References

  1. More information on REPLs
  2. More information on scripts
  3. More information on blinking an LED