{"id":33552,"date":"2017-06-27T12:21:26","date_gmt":"2017-06-27T11:21:26","guid":{"rendered":"https:\/\/www.raspberrypi.org\/?p=33552"},"modified":"2021-09-19T15:06:02","modified_gmt":"2021-09-19T14:06:02","slug":"scratch-2-raspberry-pi","status":"publish","type":"post","link":"https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/","title":{"rendered":"Scratch 2.0: all-new features for your Raspberry Pi"},"content":{"rendered":"

We’re very excited to announce that Scratch 2.0 is now available as an offline app for the Raspberry Pi! This new version of Scratch allows you to control the Pi’s GPIO (General Purpose Input and Output) pins, and offers a host of\u00a0other exciting new features.<\/p>\n

\"\"<\/p>\n

Offline accessibility<\/h2>\n

The\u00a0most recent update to\u00a0Raspbian includes the app, which makes Scratch 2.0 available offline on the Raspberry Pi. This is great news for clubs and classrooms,\u00a0where children can now use Raspberry Pis\u00a0instead of connected laptops or desktops to explore block-based programming and physical computing.<\/p>\n

Controlling GPIO with Scratch 2.0<\/h2>\n

As with Scratch 1.4, Scratch 2.0 on the Raspberry Pi allows you to create\u00a0code to control and respond to components connected to the Pi’s GPIO pins. This means that your Scratch projects can light LEDs, sound buzzers and use input from buttons and a range of sensors to control\u00a0the behaviour of sprites. Interacting with GPIO pins in Scratch 2.0 is easier than ever before, as text-based broadcast instructions have been replaced with custom blocks for setting pin output and getting current pin state.<\/p>\n

\"Scratch<\/p>\n

To add GPIO functionality, first click ‘More Blocks’ and then ‘Add an Extension’. You should then select the ‘Pi GPIO’ extension option and click OK.<\/p>\n

\"Scratch<\/p>\n

In the ‘More Blocks’ section you should now see\u00a0the additional blocks for controlling and responding to your Pi GPIO pins. To give an example, the entire code for repeatedly flashing an LED connected to GPIO pin 2.0 is now:<\/p>\n

\"Flashing<\/p>\n

To react to a button connected to GPIO pin 2.0, simply set the pin as input, and use the ‘gpio (x) is high?’ block to check the button’s state. In the example below, the Scratch cat will say “Pressed” only when the button is being held down.<\/p>\n

\"Responding<\/p>\n

Cloning sprites<\/h2>\n

Scratch 2.0 also offers some additional features and improvements over Scratch 1.4. One of the main new features of Scratch 2.0 is the ability to create clones<\/b> of sprites. Clones are instances of a particular sprite that inherit all of the scripts of the main sprite.<\/p>\n

The scripts below show how cloned sprites are used — in this case to allow the Scratch cat to throw a clone of an apple sprite whenever the space key is pressed. Each apple sprite clone then follows its \u2018when i start as clone\u2019 script.<\/p>\n

\"Cloning<\/p>\n

The cloning functionality avoids the need to create multiple copies of a sprite, for example multiple enemies in a game or multiple snowflakes in an animation.<\/p>\n

Custom blocks<\/h2>\n

Scratch 2.0 also allows the creation of custom blocks<\/b>, allowing code to be encapsulated and used (possibly multiple times) in a project. The code below shows a simple custom block called \u2018jump\u2019, which is used to make a sprite jump whenever it is clicked.<\/p>\n

\"Custom<\/p>\n

These custom blocks can also optionally include parameters, allowing further generalisation and reuse of code blocks. Here\u2019s another example of a custom block that draws a shape. This time, however, the custom block includes parameters for specifying the number of sides of the shape, as well as the length of each side.<\/p>\n

\"Custom<\/p>\n

The custom block can now be used with different numbers provided, allowing lots of different shapes to be drawn.<\/p>\n

\"Drawing<\/p>\n

Peripheral interaction<\/h2>\n

Another feature of Scratch 2.0 is the addition of code blocks to allow easy interaction with a webcam or a microphone. This opens up a whole new world of possibilities, and for some examples of projects that make use of this new functionality see\u00a0Clap-O-Meter<\/a> which uses the microphone to control a noise level meter, and a Keepie Uppies<\/a> game that uses video motion to control a football. You can use the Raspberry Pi or USB cameras to detect motion in your Scratch 2.0 projects.<\/p>\n

Other new features include a vector image editor\u00a0and a sound editor, as well as lots of new sprites, costumes and backdrops.<\/p>\n

Update your Raspberry Pi for Scratch 2.0<\/h2>\n

Scratch 2.0 is available in the latest Raspbian release<\/a>, under the ‘Programming’ menu. We’ve put together a guide for getting started with Scratch 2.0 on the Raspberry Pi online<\/a> (note that\u00a0GPIO functionality is only available via the desktop version).\u00a0You can also try out Scratch 2.0 on the Pi\u00a0by having a go at a project from the\u00a0Code Club projects site<\/a>.<\/p>\n

As always, we love to see the projects you create using the Raspberry Pi. Once you’ve upgraded to Scratch 2.0, tell us about\u00a0your projects via\u00a0Twitter<\/a>, Instagram<\/a> and Facebook<\/a>, or by leaving us a comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"

We’re very excited to announce that Scratch 2.0 is now available as an offline app for the Raspberry Pi! This new version of Scratch allows you to control the Pi’s GPIO (General Purpose Input and Output) pins, and offers a host of\u00a0other exciting new features. Offline accessibility The\u00a0most recent update to\u00a0Raspbian includes the app, which…<\/p>\n","protected":false},"author":32597,"featured_media":33928,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,3879],"tags":[],"home_page_category":[],"home_page_card_color":[],"class_list":["post-33552","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","category-foundation"],"acf":[],"featured_image_src":"https:\/\/www.raspberrypi.org\/app\/uploads\/2017\/06\/cover-1.png","author_info":{"display_name":"Rik Cross","author_link":"https:\/\/www.raspberrypi.org\/blog\/author\/rikcross\/"},"yoast_head":"\nScratch 2.0: all-new features for your Raspberry Pi - Raspberry Pi Foundation<\/title>\n<meta name=\"description\" content=\"Scratch 2.0 is now available on the Raspberry Pi. Control GPIO pins, webcams and microphones, edit images and sound and more!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Scratch 2.0: all-new features for your Raspberry Pi - Raspberry Pi Foundation\" \/>\n<meta property=\"og:description\" content=\"Scratch 2.0 is now available on the Raspberry Pi. Control GPIO pins, webcams and microphones, edit images and sound and more!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/\" \/>\n<meta property=\"og:site_name\" content=\"Raspberry Pi Foundation\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/raspberrypi\" \/>\n<meta property=\"article:published_time\" content=\"2017-06-27T11:21:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-19T14:06:02+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.raspberrypi.org\/app\/uploads\/2017\/06\/cover-1-500x262.png\" \/>\n\t<meta property=\"og:image:width\" content=\"500\" \/>\n\t<meta property=\"og:image:height\" content=\"262\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Rik Cross\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodeClubRik\" \/>\n<meta name=\"twitter:site\" content=\"@Raspberry_Pi\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rik Cross\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.raspberrypi.org\\\/blog\\\/scratch-2-raspberry-pi\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.raspberrypi.org\\\/blog\\\/scratch-2-raspberry-pi\\\/\"},\"author\":{\"name\":\"Rik Cross\",\"@id\":\"https:\\\/\\\/www.raspberrypi.org\\\/#\\\/schema\\\/person\\\/40cf5d8d83cb0274d5dd64bf5bf6a5ea\"},\"headline\":\"Scratch 2.0: all-new features for your Raspberry Pi\",\"datePublished\":\"2017-06-27T11:21:26+00:00\",\"dateModified\":\"2021-09-19T14:06:02+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.raspberrypi.org\\\/blog\\\/scratch-2-raspberry-pi\\\/\"},\"wordCount\":744,\"commentCount\":47,\"image\":{\"@id\":\"https:\\\/\\\/www.raspberrypi.org\\\/blog\\\/scratch-2-raspberry-pi\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.raspberrypi.org\\\/app\\\/uploads\\\/2017\\\/06\\\/cover-1.png\",\"articleSection\":[\"Uncategorized\",\"Foundation\"],\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.raspberrypi.org\\\/blog\\\/scratch-2-raspberry-pi\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.raspberrypi.org\\\/blog\\\/scratch-2-raspberry-pi\\\/\",\"url\":\"https:\\\/\\\/www.raspberrypi.org\\\/blog\\\/scratch-2-raspberry-pi\\\/\",\"name\":\"Scratch 2.0: all-new features for your Raspberry Pi - Raspberry Pi Foundation\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.raspberrypi.org\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.raspberrypi.org\\\/blog\\\/scratch-2-raspberry-pi\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.raspberrypi.org\\\/blog\\\/scratch-2-raspberry-pi\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.raspberrypi.org\\\/app\\\/uploads\\\/2017\\\/06\\\/cover-1.png\",\"datePublished\":\"2017-06-27T11:21:26+00:00\",\"dateModified\":\"2021-09-19T14:06:02+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.raspberrypi.org\\\/#\\\/schema\\\/person\\\/40cf5d8d83cb0274d5dd64bf5bf6a5ea\"},\"description\":\"Scratch 2.0 is now available on the Raspberry Pi. Control GPIO pins, webcams and microphones, edit images and sound and more!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.raspberrypi.org\\\/blog\\\/scratch-2-raspberry-pi\\\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.raspberrypi.org\\\/blog\\\/scratch-2-raspberry-pi\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.raspberrypi.org\\\/blog\\\/scratch-2-raspberry-pi\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.raspberrypi.org\\\/app\\\/uploads\\\/2017\\\/06\\\/cover-1.png\",\"contentUrl\":\"https:\\\/\\\/www.raspberrypi.org\\\/app\\\/uploads\\\/2017\\\/06\\\/cover-1.png\",\"width\":688,\"height\":361},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.raspberrypi.org\\\/blog\\\/scratch-2-raspberry-pi\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.raspberrypi.org\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Scratch 2.0: all-new features for your Raspberry Pi\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.raspberrypi.org\\\/#website\",\"url\":\"https:\\\/\\\/www.raspberrypi.org\\\/\",\"name\":\"Raspberry Pi Foundation\",\"description\":\"Teach, learn and make with Raspberry Pi\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.raspberrypi.org\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.raspberrypi.org\\\/#\\\/schema\\\/person\\\/40cf5d8d83cb0274d5dd64bf5bf6a5ea\",\"name\":\"Rik Cross\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/www.raspberrypi.org\\\/app\\\/uploads\\\/2018\\\/02\\\/Rik-Cross.jpg\",\"url\":\"https:\\\/\\\/www.raspberrypi.org\\\/app\\\/uploads\\\/2018\\\/02\\\/Rik-Cross.jpg\",\"contentUrl\":\"https:\\\/\\\/www.raspberrypi.org\\\/app\\\/uploads\\\/2018\\\/02\\\/Rik-Cross.jpg\",\"caption\":\"Rik Cross\"},\"description\":\"Rik works to ensure that educators have comprehensive, high-quality curricula, resources and professional development opportunities to support the teaching of computing to young people all over the world. Rik also enjoys game development, board games and brewing beer.\",\"sameAs\":[\"https:\\\/\\\/x.com\\\/CodeClubRik\"],\"url\":\"https:\\\/\\\/www.raspberrypi.org\\\/blog\\\/author\\\/rikcross\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Scratch 2.0: all-new features for your Raspberry Pi - Raspberry Pi Foundation","description":"Scratch 2.0 is now available on the Raspberry Pi. Control GPIO pins, webcams and microphones, edit images and sound and more!","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/","og_locale":"en_GB","og_type":"article","og_title":"Scratch 2.0: all-new features for your Raspberry Pi - Raspberry Pi Foundation","og_description":"Scratch 2.0 is now available on the Raspberry Pi. Control GPIO pins, webcams and microphones, edit images and sound and more!","og_url":"https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/","og_site_name":"Raspberry Pi Foundation","article_publisher":"https:\/\/www.facebook.com\/raspberrypi","article_published_time":"2017-06-27T11:21:26+00:00","article_modified_time":"2021-09-19T14:06:02+00:00","og_image":[{"width":500,"height":262,"url":"https:\/\/www.raspberrypi.org\/app\/uploads\/2017\/06\/cover-1-500x262.png","type":"image\/png"}],"author":"Rik Cross","twitter_card":"summary_large_image","twitter_creator":"@CodeClubRik","twitter_site":"@Raspberry_Pi","twitter_misc":{"Written by":"Rik Cross","Estimated reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/#article","isPartOf":{"@id":"https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/"},"author":{"name":"Rik Cross","@id":"https:\/\/www.raspberrypi.org\/#\/schema\/person\/40cf5d8d83cb0274d5dd64bf5bf6a5ea"},"headline":"Scratch 2.0: all-new features for your Raspberry Pi","datePublished":"2017-06-27T11:21:26+00:00","dateModified":"2021-09-19T14:06:02+00:00","mainEntityOfPage":{"@id":"https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/"},"wordCount":744,"commentCount":47,"image":{"@id":"https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/#primaryimage"},"thumbnailUrl":"https:\/\/www.raspberrypi.org\/app\/uploads\/2017\/06\/cover-1.png","articleSection":["Uncategorized","Foundation"],"inLanguage":"en-GB","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/","url":"https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/","name":"Scratch 2.0: all-new features for your Raspberry Pi - Raspberry Pi Foundation","isPartOf":{"@id":"https:\/\/www.raspberrypi.org\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/#primaryimage"},"image":{"@id":"https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/#primaryimage"},"thumbnailUrl":"https:\/\/www.raspberrypi.org\/app\/uploads\/2017\/06\/cover-1.png","datePublished":"2017-06-27T11:21:26+00:00","dateModified":"2021-09-19T14:06:02+00:00","author":{"@id":"https:\/\/www.raspberrypi.org\/#\/schema\/person\/40cf5d8d83cb0274d5dd64bf5bf6a5ea"},"description":"Scratch 2.0 is now available on the Raspberry Pi. Control GPIO pins, webcams and microphones, edit images and sound and more!","breadcrumb":{"@id":"https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/#primaryimage","url":"https:\/\/www.raspberrypi.org\/app\/uploads\/2017\/06\/cover-1.png","contentUrl":"https:\/\/www.raspberrypi.org\/app\/uploads\/2017\/06\/cover-1.png","width":688,"height":361},{"@type":"BreadcrumbList","@id":"https:\/\/www.raspberrypi.org\/blog\/scratch-2-raspberry-pi\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.raspberrypi.org\/"},{"@type":"ListItem","position":2,"name":"Scratch 2.0: all-new features for your Raspberry Pi"}]},{"@type":"WebSite","@id":"https:\/\/www.raspberrypi.org\/#website","url":"https:\/\/www.raspberrypi.org\/","name":"Raspberry Pi Foundation","description":"Teach, learn and make with Raspberry Pi","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.raspberrypi.org\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"https:\/\/www.raspberrypi.org\/#\/schema\/person\/40cf5d8d83cb0274d5dd64bf5bf6a5ea","name":"Rik Cross","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/www.raspberrypi.org\/app\/uploads\/2018\/02\/Rik-Cross.jpg","url":"https:\/\/www.raspberrypi.org\/app\/uploads\/2018\/02\/Rik-Cross.jpg","contentUrl":"https:\/\/www.raspberrypi.org\/app\/uploads\/2018\/02\/Rik-Cross.jpg","caption":"Rik Cross"},"description":"Rik works to ensure that educators have comprehensive, high-quality curricula, resources and professional development opportunities to support the teaching of computing to young people all over the world. Rik also enjoys game development, board games and brewing beer.","sameAs":["https:\/\/x.com\/CodeClubRik"],"url":"https:\/\/www.raspberrypi.org\/blog\/author\/rikcross\/"}]}},"_links":{"self":[{"href":"https:\/\/www.raspberrypi.org\/wp-json\/wp\/v2\/posts\/33552","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.raspberrypi.org\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.raspberrypi.org\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.raspberrypi.org\/wp-json\/wp\/v2\/users\/32597"}],"replies":[{"embeddable":true,"href":"https:\/\/www.raspberrypi.org\/wp-json\/wp\/v2\/comments?post=33552"}],"version-history":[{"count":31,"href":"https:\/\/www.raspberrypi.org\/wp-json\/wp\/v2\/posts\/33552\/revisions"}],"predecessor-version":[{"id":33930,"href":"https:\/\/www.raspberrypi.org\/wp-json\/wp\/v2\/posts\/33552\/revisions\/33930"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.raspberrypi.org\/wp-json\/wp\/v2\/media\/33928"}],"wp:attachment":[{"href":"https:\/\/www.raspberrypi.org\/wp-json\/wp\/v2\/media?parent=33552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.raspberrypi.org\/wp-json\/wp\/v2\/categories?post=33552"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.raspberrypi.org\/wp-json\/wp\/v2\/tags?post=33552"},{"taxonomy":"home_page_category","embeddable":true,"href":"https:\/\/www.raspberrypi.org\/wp-json\/wp\/v2\/home_page_category?post=33552"},{"taxonomy":"home_page_card_color","embeddable":true,"href":"https:\/\/www.raspberrypi.org\/wp-json\/wp\/v2\/home_page_card_color?post=33552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}