raspberry piscratchfeatures

Scratch2.0——New features for Raspberry Pi

Scratch2.0——New features for Raspberry Pi

To control GPIO

We can control the GPIO output and get the GPIO input by dragging modules.This means that we can use Scratch to light the LED, control the buzzer, get the button and other sensors signal so we can control the action of the scratch kitten.More convenient than ever before,with the following two modules we will be able to complete the input and output operations.

It is easy to add these two modules.

Open Scratch2.0>click More Blocks and Add an Extension>Select an extension of Pi GPIO>Click OK

Under the More Block section you will see the two modules

Connecting GPIO2 to an LED, using the following example to make the LED flash.

Connecting GPIO2 to a button, set the pins to input, and then use the"gpio _ is high?"module to detect the status of the button.In the following example, when the button is pressed the Scratch kitten will say"press".



Compared to the 1.4 version, Scratch 2.0 also provides some additional new features.One of the most important new features is that we can create a copy of the sprite.In other words, from a sprite copy into multiple.Each copy is an instance of a sprite that inherits its script module from the beginning of the sprite.

For example,each time you press space,the Scratch kitten throws a copy of the apple instance.When an apple is copied, it will execute script"when I start as a clone".

Through this new feature, we don't need to create the same sprite repeatedly.(Such as when the game needs to create a group of enemies)

Custom modules

Like the definition function, Scratch2.0 supports custom modules.This facilitates the user to call the application multiple times in a project.The following example shows a custom module of jump.With this module, you can apply this effect to all sprites.

When you customize the module, you can add the input value (parameter).The following example of the graphics module, there are two parameters, one is the number of graphics edge, one is the length.The same custom module, when you enter a different parameter value you can get a different effect.


Scratch 2.0 has a corresponding module to support a simple interaction with the webcam, microphone.

The project Clap-O-Meter can detect the intensity of noise through a microphone.

The game Keepie Uppies can control a football through a camera.

There are also a few new features, including vector editor and sound editor, as well as many new characters.

Source URL


JollyAug 31,2017 16:51 PMAdd Comment


Popular Topics