Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Physical computing with Scratch and Python
Search
Ben Nuttall
March 21, 2016
Education
370
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Physical computing with Scratch and Python
Physical computing with Raspberry Pi using Scratch and Python with GPIO Zero
Ben Nuttall
March 21, 2016
More Decks by Ben Nuttall
See All by Ben Nuttall
Numeronyms are obnoxious
bennuttall
1
710
Live Highlights in BBC iPlayer
bennuttall
0
180
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
240
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
180
Running a Python Package Index for Raspberry Pi
bennuttall
0
210
From Acorns to Raspberries
bennuttall
0
180
Innovation in the newsroom
bennuttall
0
230
Innovation in the newsroom - MOS Running Order Manager
bennuttall
0
260
How to market your open source project
bennuttall
0
300
Other Decks in Education
See All in Education
Gitがない時代 インターネットがない時代の 開発話
sapi_kawahara
0
390
解決策を教えても次期リーダーは育たない ─ 器の発達に伴走するために / Partnering with leaders in their vertical development
matsu0228
1
700
チームの鏡になるー自分の癖を知ると、チームのパターンが見えてくる@スクフェス仙台
saorimurooka
0
170
Geografía y fútbol. Atlanta. la megalópolis del fútbol
juanmartin2026
1
12k
観察、仮説、実行、検証、計画、提案を一年で3000回トレーニングする方法/3000 Thinking Loops in 365 Days
moriyuya
5
1.3k
データマネジメント試験対策教材1〜データマネジメント基礎〜
yoshimura_datam
1
710
[2026前期火5] 論理学(京都大学文学部 前期 第9回)「正規化の停止性——ヒドラゲームによる証明」
yatabe
0
270
AI Generated Beer
lonbrew
0
100
ちいかわを読め
uchi8977
1
320
AIがコードを書く時代に、何を教えるのか / What Should We Teach in the Age of AI-Generated Code?
ichiroc
1
540
1人 × AI、1か月でここまで作れる ー 数年前の外注換算3.8〜7.4億円・241〜379人月分の作業を、AI費用 約10万円・31日で
frievea
0
460
人間のために、人間と共に働く時代の終わりの始まり
frievea
0
170
Featured
See All Featured
A designer walks into a library…
pauljervisheath
211
25k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
260
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.4k
The Cost Of JavaScript in 2023
addyosmani
55
10k
Practical Orchestrator
shlominoach
191
12k
How Fast Is Fast Enough? [PerfNow 2025]
tammyeverts
3
870
We Are The Robots
honzajavorek
0
340
Abbi's Birthday
coloredviolet
3
9.8k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
520
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Product Roadmaps are Hard
iamctodd
55
13k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Transcript
Physical Computing with Scratch and Python
None
Boot the Pi and open Scratch
GPIO Server • GPIO Server On
Broadcast • configXout • gpioXon • gpioXoff • wait X
secs • forever Component GPIO pin Red LED 25 Amber LED 8 Green LED 7 Buzzer 15
Close Scratch and open Python 3
Open a new file • File > New File •
File > Save • Save as camjam.py
GPIO Zero LED from gpiozero import LED led = LED(25)
while True: led.on() sleep(1) led.off() sleep(1) Save and run: Ctrl + S F5
GPIO Zero LED from gpiozero import LED led = LED(25)
led.blink()
GPIO Zero Button + LED from gpiozero import Button, LED
button = Button(21) led = LED(25) while True: button.wait_for_press() led.on() button.wait_for_release() led.off()
GPIO Zero Button + LED from gpiozero import Button, LED
button = Button(21) led = LED(25) while True: led.on() button.wait_for_press() led.off() button.wait_for_release()
GPIO Zero Button + LED from gpiozero import Button, LED
button = Button(21) led = LED(25) while True: led.blink() button.wait_for_press() led.off() button.wait_for_release()
Traffic Lights from gpiozero import Button, TrafficLights button = Button(21)
lights = TrafficLights(25, 8, 7) while True: button.wait_for_press() lights.on() button.wait_for_release() lights.off()
Traffic Lights from gpiozero import Button, TrafficLights button = Button(21)
lights = TrafficLights(25, 8, 7) while True: lights.blink() button.wait_for_press() lights.on() button.wait_for_release()
Traffic Lights from gpiozero import Button, TrafficLights, Buzzer from time
import sleep button = Button(21) lights = TrafficLights(25, 8, 7) buzzer = Buzzer(15) while True: lights.on() buzzer.off() button.wait_for_press() lights.off() buzzer.on() button.wait_for_release()
Traffic Lights while True: lights.green.on() sleep(1) lights.amber.on() sleep(1) lights.red.on() sleep(1)
lights.off()
Traffic Lights while True: button.wait_for_press() lights.green.on() sleep(1) lights.amber.on() sleep(1) lights.red.on()
sleep(1) lights.off()
Traffic Lights Sequence • Can you make a full traffic
lights sequence? • Use the button for a pedestrian crossing • Use buzzer.beep() to indicate safe crossing
Documentation and help guides • raspberrypi.org/documentation/usage/scratch/gpio • gpiozero.readthedocs.org • raspberrypi.org/resources
• raspberrypi.org/education/downloads
Physical Computing with Scratch and Python