Академический Документы
Профессиональный Документы
Культура Документы
physical
Scratch +
Python
Workshop outline
Why physical computing
Build simple circuit using Raspberry Pi
Control an output using Scratch on Raspberry Pi
Create more complex circuits and programs
You will need:
#picademy
rpf.io/learn
Physical Computing
Enables creators to connect the virtual world with the physical, great for engagement.
#picademy
rpf.io/learn
Simple Circuit
Your Raspberry Pi can act as the power supply for simple circuits, we can use this test our
hardware is working.
#picademy
rpf.io/learn
Simple Circuit
Your Raspberry Pi can act as the power supply for simple circuits, we can use this test our
hardware is working.
#picademy
rpf.io/learn
Inside a breadboard
#picademy
rpf.io/learn
Switching Circuit
Your Raspberry Pi can act as a switch in the circuit, which can be controlled in software.
#picademy
rpf.io/learn
Switching Circuit
Your Raspberry Pi can act as a switch in the circuit, which can be controlled in software.
Connect the positive leg of the LED to GPIO pin 17 on your Raspberry Pi
#picademy
rpf.io/learn
gpioserveron
#picademy
rpf.io/learn
Blinking LED
Setup
your
pin
(17)
as an
outpu
t.
config17o
ut
Switc
h pin
17 on
gpio17on
Switc
h pin
17 of
gpio17of
Pause
Loop
forev
er
#picademy
Reflection
#picademy
rpf.io/learn
Example Programs
# Flashing LED
#picademy
rpf.io/learn
Example Programs
# Flashing LED
#picademy
rpf.io/learn
Further abstraction
G PIO Zero includes severalabstractions for
use w ith m ore com plex hardw are:
# Traf f
c Lights
i
from gpiozero im port Traf f
cLights
i
from tim e im port sleep
lights = Traf f
cLights(9, 10, 11)
i
lights.red.on()
sleep(3)
lights.red.off
()
lights.am ber.on()
#picademy
rpf.io/learn