{"id":14711,"date":"2018-01-21T18:21:06","date_gmt":"2018-01-21T23:21:06","guid":{"rendered":"http:\/\/scruss.com\/blog\/?p=14711"},"modified":"2019-01-27T14:00:19","modified_gmt":"2019-01-27T19:00:19","slug":"raspblocks-blocks-based-python-coding-for-raspberry-pi","status":"publish","type":"post","link":"https:\/\/scruss.com\/blog\/2018\/01\/21\/raspblocks-blocks-based-python-coding-for-raspberry-pi\/","title":{"rendered":"Raspblocks: Blocks-based Python coding for Raspberry Pi"},"content":{"rendered":"<p><strong>Update, 2019-01<\/strong>: raspblocks.com appears to be dead, with an &#8220;Account Suspended&#8221; error from the host<\/p>\n<p><a href=\"http:\/\/www.raspblocks.com\/index.html\">Raspblocks<\/a> is a new <a href=\"https:\/\/en.wikipedia.org\/wiki\/Blockly\">Blocks<\/a>-based web programming environment for Raspberry Pi. You don&#8217;t even need to write the code on a Raspberry Pi, but the Python 3 code it produces will need to be transferred to a Raspberry Pi to run.<\/p>\n<p>For maximum authenticity (and slowness), I fired up\u00c2\u00a0 <a href=\"http:\/\/www.raspblocks.com\/\">http:\/\/www.raspblocks.com\/<\/a> on a Raspberry Pi Zero over VNC. It took a minute or more to load up the site in Chromium, but creating a simple program was all easy dragging and dropping:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-full wp-image-14712\" src=\"http:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2018\/01\/Screenshot-from-2018-01-21-17-24-38.png\" alt=\"\" width=\"578\" height=\"249\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2018\/01\/Screenshot-from-2018-01-21-17-24-38.png 578w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2018\/01\/Screenshot-from-2018-01-21-17-24-38-160x69.png 160w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2018\/01\/Screenshot-from-2018-01-21-17-24-38-320x138.png 320w\" sizes=\"auto, (max-width: 578px) 100vw, 578px\" \/><\/p>\n<p>The code it produced was pretty much exactly what you&#8217;d write by hand:<\/p>\n<pre><pre class=\"brush: python; title: ; notranslate\" title=\"\">\nimport RPi.GPIO as GPIO\nimport time\nGPIO.setmode(GPIO.BCM)\nGPIO.setup(26, GPIO.OUT)\n\nwhile True:\n    GPIO.output(26,True)\n    time.sleep(1)\n    GPIO.output(26,False)\n    time.sleep(1)\n<\/pre>\n<p>And, as you might expect, the code make an LED connected to GPIO 26 turn on and off. <em>Science!<\/em><\/p>\n<p>Raspblocks isn&#8217;t as polished as its more established rival\u00c2\u00a0 <a href=\"http:\/\/edublocks.org\/\">EduBlocks<\/a>, but Raspblocks doesn&#8217;t need any software installed. Edublocks installs its own Node.js-based web service, which would be painfully slow on a Raspberry Pi Zero. Raspblocks&#8217; code needs to be run manually from a terminal, but I&#8217;d put up with that any day over having <em>yet another<\/em> Node server distribution installed under \/opt.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Update, 2019-01: raspblocks.com appears to be dead, with an &#8220;Account Suspended&#8221; error from the host Raspblocks is a new Blocks-based web programming environment for Raspberry Pi. You don&#8217;t even need to write the code on a Raspberry Pi, but the Python 3 code it produces will need to be transferred to a Raspberry Pi to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7],"tags":[3111,2540,2510],"class_list":["post-14711","post","type-post","status-publish","format-standard","hentry","category-computers-suck","tag-blocks","tag-python","tag-raspberrypi"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pQNZZ-3Ph","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/14711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/comments?post=14711"}],"version-history":[{"count":3,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/14711\/revisions"}],"predecessor-version":[{"id":15332,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/14711\/revisions\/15332"}],"wp:attachment":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/media?parent=14711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/categories?post=14711"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/tags?post=14711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}