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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
490
Live Highlights in BBC iPlayer
bennuttall
0
160
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
220
Rapid prototyping in BBC News with Python and AWS
bennuttall
0
160
Running a Python Package Index for Raspberry Pi
bennuttall
0
190
From Acorns to Raspberries
bennuttall
0
160
Innovation in the newsroom
bennuttall
0
220
Innovation in the newsroom - MOS Running Order Manager
bennuttall
0
240
How to market your open source project
bennuttall
0
280
Other Decks in Education
See All in Education
Design Guidelines and Principles - Lecture 7 - Information Visualisation (4019538FNR)
signer
PRO
0
3k
Data Presentation - Lecture 5 - Information Visualisation (4019538FNR)
signer
PRO
1
3.2k
勾配ブースティングと決定木の話 / gradient boosting and decision trees
kaityo256
PRO
6
1.2k
AWS Certified Generative AI Developer - Professional Beta 不合格体験記
amarelo_n24
1
300
勝手にCULTIBASE で広げよう、探究の輪! - CULTIVAL 2026
hiroc_sk
1
210
Gitがない時代 インターネットがない時代の 開発話
sapi_kawahara
0
250
Why the humanities may be your best career bet
figarospeech
0
190
生成AI時代の情報発信
molmolken
0
120
Lenguajes de Programacion (Ingresantes UNI 2026)
robintux
0
180
モブ社員がモブエンジニアを名乗って得られたこと_20260413
masakiokuda
4
510
[2026前期火5] 論理学(京都大学文学部 前期 第3回)「形式言語と四つのキーワード:メタ・構成・意味論・ハーモニー」
yatabe
0
490
「機械学習と因果推論」入門① 因果効果とは
masakat0
0
1.8k
Featured
See All Featured
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
470
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
55k
Music & Morning Musume
bryan
47
7.2k
Paper Plane (Part 1)
katiecoart
PRO
0
8.1k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2.1k
Exploring anti-patterns in Rails
aemeredith
3
380
Dominate Local Search Results - an insider guide to GBP, reviews, and Local SEO
greggifford
PRO
0
180
Side Projects
sachag
455
43k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
950
Six Lessons from altMBA
skipperchong
29
4.3k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
25k
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