{"id":61,"date":"2013-04-29T09:10:52","date_gmt":"2013-04-29T09:10:52","guid":{"rendered":"http:\/\/scratchincontrol.com\/?p=61"},"modified":"2013-04-29T09:10:52","modified_gmt":"2013-04-29T09:10:52","slug":"slide-potentiometers-and-breakout-games","status":"publish","type":"post","link":"https:\/\/scratchincontrol.com\/?p=61","title":{"rendered":"Slide Potentiometers and Breakout Games"},"content":{"rendered":"<p>I like Arduinos &#8211; I tell my students that an arduino is a tiny &#8216;robot&#8217; brain. Later on in the course I explaint to them that teachers lie all the time, because they can&#8217;t handle the truth&#8230;<\/p>\n<p>Scratch for Arduino (S4A) is a variation of Scratch written to allow it to communicate directly with an Arduino board. Why would you want to do that? I hear you ask. Because you can tell Scratch to respond to a wider range of inputs than with a Picoboard or Makey-Makey. Plus, Scratch can then send instructions to servos, motors, LEDs and more to switch them on and off.<\/p>\n<p>So, how long does it take to connect a slide potentiometer to S4A and write a simple Scratch Breakout game?<\/p>\n<figure style=\"width: 491px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"http:\/\/scratchincontrol.com\/images\/potentiometer.jpg\" width=\"491\" height=\"358\" \/><figcaption class=\"wp-caption-text\">A slide potentiometer connected to an Arduino<\/figcaption><\/figure>\n<p>It took me a few minutes to hook up a slide potentiomwter (cost &#8211; CZK37 &#8211; less than US$2) to an Arduino using some jumper wites and alligator clips I just happened to have lying about the place. The code took a couple of minutes &#8211; I wanted to do something reasonably straightforwards that a student could do using a little bit of trial and error.<\/p>\n<p>Here&#8217;s the scripts.<\/p>\n<figure style=\"width: 330px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"http:\/\/scratchincontrol.com\/images\/paddlescript.gif\" width=\"330\" height=\"123\" \/><figcaption class=\"wp-caption-text\">The script for moving the paddle<\/figcaption><\/figure>\n<figure style=\"width: 336px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"http:\/\/scratchincontrol.com\/images\/ballscript.gif\" width=\"336\" height=\"275\" \/><figcaption class=\"wp-caption-text\">The script for moving and bouncing the ball<\/figcaption><\/figure>\n<p>And here&#8217;s a screenshot.<\/p>\n<figure style=\"width: 495px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" src=\"http:\/\/scratchincontrol.com\/images\/s4a-ss1.png\" width=\"495\" height=\"449\" \/><figcaption class=\"wp-caption-text\">A screenshot of a very simple Breakout game &#8211; what would you do to improve it?<\/figcaption><\/figure>\n<p>If you want to try this for yourself, and you&#8217;re free on May 18 in Prague &#8211; come and visit us at <a title=\"Scratch in Control - a free course for teachers\" href=\"http:\/\/scratchincontrol.eventbrite.com\">Scratch in Control<\/a>&#8230;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I like Arduinos &#8211; I tell my students that an arduino is a tiny &#8216;robot&#8217; brain. Later on in the course I explaint to them that teachers lie all the time, because they can&#8217;t handle the truth&#8230; Scratch for Arduino (S4A) is a variation of Scratch written to allow it to communicate directly with an &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/scratchincontrol.com\/?p=61\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Slide Potentiometers and Breakout Games&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[29,4],"tags":[37,33,36],"class_list":["post-61","post","type-post","status-publish","format-standard","hentry","category-coding","category-updates","tag-arduino","tag-game","tag-s4a"],"_links":{"self":[{"href":"https:\/\/scratchincontrol.com\/index.php?rest_route=\/wp\/v2\/posts\/61","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scratchincontrol.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scratchincontrol.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scratchincontrol.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/scratchincontrol.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=61"}],"version-history":[{"count":2,"href":"https:\/\/scratchincontrol.com\/index.php?rest_route=\/wp\/v2\/posts\/61\/revisions"}],"predecessor-version":[{"id":63,"href":"https:\/\/scratchincontrol.com\/index.php?rest_route=\/wp\/v2\/posts\/61\/revisions\/63"}],"wp:attachment":[{"href":"https:\/\/scratchincontrol.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=61"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scratchincontrol.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=61"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scratchincontrol.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=61"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}