Data Sheet
UCTRONICS Ultimate Starter Leaning Kit for Raspberry Pi #K0064
69 www.uctronics.com
8.6 Project 6: LED Flowing Lights
8.6.1 Overview
In the first class, we have learned how to make an LED blink by programming the Raspberry
Pi. Today, we will use the Raspberry Pi to control 8 LEDs, so that 8 LEDs showing the result of
flowing.
8.6.2 Requirement
Raspberry Pi ×1
LED ×8
220Ω Resistor ×8
Breadboard ×1
Several Jumper wires
8.6.3 Principle
1. Key function:
● for statements
The for statement is used to repeat a block of statements enclosed in curly braces. An
increment counter is usually used to increment and terminate the loop. The for statement is
useful for any repetitive operation, and is often used in combination with arrays to operate
on collections of data/pins.
There are three parts to the for loop header:
for (initialization; condition; increment) {
//statement(s);
}
The initialization happens first and exactly once. Each time through the loop, the condition is