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
360
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
570
Live Highlights in BBC iPlayer
bennuttall
0
170
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
240
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
170
Running a Python Package Index for Raspberry Pi
bennuttall
0
200
From Acorns to Raspberries
bennuttall
0
170
Innovation in the newsroom
bennuttall
0
230
Innovation in the newsroom - MOS Running Order Manager
bennuttall
0
250
How to market your open source project
bennuttall
0
300
Other Decks in Education
See All in Education
学習者データを「見る」:外国語教師のためのデータの入力、分析、解釈方法
uranoken
0
230
0526
cbtlibrary
0
230
Case Studies - Lecture 12 - Information Visualisation (4019538FNR)
signer
PRO
0
220
면접관 눈에 띄는 데이터 분석 포트폴리오 만드는 법 | 2026년 5월 세미나
datarian
0
1k
自己紹介 / who-am-i
yasulab
6
7.1k
[2026前期火5] 論理学(京都大学文学部 前期 第14回)「計算は、証明ではない——ハルシネーションを三層ハーモニーで診る」
yatabe
0
190
形骸化しない社内勉強会の取り組み - オーナーシップの作り方 / In-house study session
soudai
PRO
0
180
[2026前期火5] 論理学(京都大学文学部 前期 第6回)「かつとまたはの規則」
yatabe
0
470
Visionary Initiative: Future Intelligence 「未来の知性と社会の礎を築く」|Science Tokyo(東京科学大学)
sciencetokyo
PRO
0
1.2k
Examen de Selectividad. Geografía julio 2026 (Convocatoria Extraordinaria). UCLM
juanmartin2026
1
12k
Beyond the Prompt: Programming as a Pathway to Statistical Thinking
minecr
0
320
[2026前期火5] 論理学(京都大学文学部 前期 第5回)「 ならばの問題演習・proof net・かつの規則」
yatabe
0
390
Featured
See All Featured
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
200
A Tale of Four Properties
chriscoyier
163
24k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.3k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
650
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
670
How to Talk to Developers About Accessibility
jct
2
520
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
650
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
290
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
770
ラッコキーワード サービス紹介資料
rakko
1
4.4M
So, you think you're a good person
axbom
PRO
2
2.1k
The untapped power of vector embeddings
frankvandijk
2
1.8k
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