Set up Sense HAT inputs in Scratch 3
Linux Format|September 2021
Les Pounder shows how to obtain data and control sprites using the Sense HAT add-on board with Scratch 3.
Les Pounder
Set up Sense HAT inputs in Scratch 3

YOU NEED

  • Raspberry Pi 3B+ or better

  • Sense HAT

  • Latest Raspbian release

  • Code: https:// github.com/ lesp/ LXF280Sense-Bats/ archive/ refs/heads/ main.zip

This month we’ll use the scientific powerhouse Sense HAT board with Scratch 3 to create four quick projects to demonstrate the power of Scratch 3 and the Sense HAT.

The Sense HAT is a remarkable board. Released in 2015, it works with Python, Node-RED and for this tutorial it works with Scratch 3 thanks to a special palette of blocks that enable anyone to use the sensors, display and joystick with very little coding knowledge.

With the power off, connect the Sense HAT to all 40 pins of the GPIO, ensuring that the board fits neatly over the Pi. Use the brass standoff, provided with the Sense HAT to fix the board firmly in place. Connect your peripherals and then power up the Raspberry Pi to the desktop.

Scratch 3 should come pre-installed on your Raspberry Pi OS image, but just in case it’s missing it can be installed from the main menu, under Preferences>Recommended Software. Scratch 3 is found in the Programming category: place a tick in the box and click Apply to install. Once installed, Scratch 3 can be found in the main menu under Programming.

Open Scratch 3 (on first start Scratch may take a little while to open). We’re going to assume that you have an understanding of how to code with Scratch, but if not we covered the basics in previous issues. Before we write any new code we need to click the blue folder icon in the bottom left of the screen to load the Extensions menu. From there select Raspberry Pi Sense HAT and a palette of new blocks are added to our code.

Project 1: Spin me right round

この記事は Linux Format の September 2021 版に掲載されています。

7 日間の Magzter GOLD 無料トライアルを開始して、何千もの厳選されたプレミアム ストーリー、9,000 以上の雑誌や新聞にアクセスしてください。

この記事は Linux Format の September 2021 版に掲載されています。

7 日間の Magzter GOLD 無料トライアルを開始して、何千もの厳選されたプレミアム ストーリー、9,000 以上の雑誌や新聞にアクセスしてください。

LINUX FORMATのその他の記事すべて表示
Create your first WebSocket service
Linux Format

Create your first WebSocket service

Mihalis Tsoukalos explains how to use the Go programming language to work with the WebSocket protocol.

time-read
9 分  |
April 2023
Fantastic Mr Firefox
Linux Format

Fantastic Mr Firefox

Nick Peers takes a trip down memory lane to reveal the story behind the rise - and slight fall - of Mozilla's popular web browser.

time-read
9 分  |
April 2023
Set up your terminal and email like it's 1983
Linux Format

Set up your terminal and email like it's 1983

Jump in the hot terminal time machine with Mats Tage Axelsson who emails from the command line using the latest technology.

time-read
8 分  |
April 2023
Universal layer text effects with GIMP
Linux Format

Universal layer text effects with GIMP

Posters use them, films and presentations are hard to imagine without them: text effects. Attract attention with Karsten Günther and GIMP.

time-read
8 分  |
April 2023
Jump to a federated social network
Linux Format

Jump to a federated social network

Nick Peers reveals how you can get up and running with this free, decentralised and non-profit alternative to Twitter.

time-read
9 分  |
April 2023
Free our SOFTWARE!
Linux Format

Free our SOFTWARE!

Taking anything for granted is dangerous, so Jonni Bidwell and Mike Saunders revisit how the free software movement got started to help free us from proprietary tyranny!

time-read
4 分  |
April 2023
Master RPI.GPIO
Linux Format

Master RPI.GPIO

Les Pounder goes back to the early days of the Raspberry Pi - and his career with this classic library! -

time-read
5 分  |
April 2023
Waveshare Zero to Pi3
Linux Format

Waveshare Zero to Pi3

Transform your Pi Zero into a Pi 3, they promised Les Pounder, but it's more like adding on go-faster stripes.

time-read
2 分  |
April 2023
The Best OPEN SOURCE Software Ever!
Linux Format

The Best OPEN SOURCE Software Ever!

In an attempt to trigger controversy, Michael Reed and Neil Mohr unequivocally state these are the greatest free software apps ever. Probably. We’re just trying to be helpful.

time-read
10+ 分  |
April 2023
Linux-Mandrake 7
Linux Format

Linux-Mandrake 7

Simplicity and a wide range of applications make this a great distribution for all Linux users.

time-read
2 分  |
April 2023