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
350
0
Share
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
0
480
Live Highlights in BBC iPlayer
bennuttall
0
150
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
210
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
150
Running a Python Package Index for Raspberry Pi
bennuttall
0
180
From Acorns to Raspberries
bennuttall
0
160
Innovation in the newsroom
bennuttall
0
210
Innovation in the newsroom - MOS Running Order Manager
bennuttall
0
230
How to market your open source project
bennuttall
0
270
Other Decks in Education
See All in Education
What workforce agencies must have in place to compete for and deliver on RESTART grants
territorium
PRO
0
150
Modelamiento Matematico (Ingresantes UNI 2026)
robintux
0
280
Gesture-based Interaction - Lecture 6 - Next Generation User Interfaces (4018166FNR)
signer
PRO
1
2.2k
応募課題(’25広島)
forget1900
0
1.3k
SL AMIGOS 教育格差と私たちの取り組み - スリランカの支援学校への支援プロジェクト:リシンドゥ リオ 氏 (別府溝部学園短期大学 ビジネス観光コース 留学生):2720 Japan O.K. ロータリーEクラブ2026年4月6日卓話
2720japanoke
0
570
Liberalism's Last Man and Asia
vyadav
0
120
Pen-based Interaction - Lecture 4 - Next Generation User Interfaces (4018166FNR)
signer
PRO
0
2.3k
アジャイルなマインドセットを「取り戻す」新人研修づくり
chinmo
2
520
教育現場から見た Ruby on Rails
yasslab
PRO
0
140
モブ社員がモブエンジニアを名乗って得られたこと_20260413
masakiokuda
4
480
0513
cbtlibrary
0
130
0415
cbtlibrary
0
170
Featured
See All Featured
Discover your Explorer Soul
emna__ayadi
2
1.1k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.6k
A Modern Web Designer's Workflow
chriscoyier
698
190k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Automating Front-end Workflow
addyosmani
1370
200k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
280
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
170
Abbi's Birthday
coloredviolet
2
7.6k
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
160
SEO for Brand Visibility & Recognition
aleyda
0
4.5k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
920
4 Signs Your Business is Dying
shpigford
187
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