{"id":16925,"date":"2021-11-18T08:14:20","date_gmt":"2021-11-18T13:14:20","guid":{"rendered":"https:\/\/scruss.com\/blog\/?p=16925"},"modified":"2021-11-18T08:14:20","modified_gmt":"2021-11-18T13:14:20","slug":"autumn-in-canada-picomite-version","status":"publish","type":"post","link":"https:\/\/scruss.com\/blog\/2021\/11\/18\/autumn-in-canada-picomite-version\/","title":{"rendered":"Autumn in Canada: PicoMite version"},"content":{"rendered":"\n<p>So I ported <a href=\"https:\/\/openprocessing.org\/sketch\/995420\">autumn in canada<\/a> from OpenProcessing to <a href=\"https:\/\/geoffg.net\/picomite.html\">PicoMite<\/a> BASIC on the Raspberry Pi Pico:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"320\" height=\"240\" src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/11\/autumn0.png\" alt=\"a small black screen images with text in the centre: autumn in canada scruss, 2021-11 just watch ...\" class=\"wp-image-16930\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/11\/autumn0.png 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/11\/autumn0-160x120.png 160w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><figcaption>no leaves<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"320\" height=\"240\" src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/11\/autumn1.png\" alt=\"a small black screen images with text in the centre: autumn in canada scruss, 2021-11 just watch ... with one red and one orange maple leaf sitting on top of it\" class=\"wp-image-16929\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/11\/autumn1.png 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/11\/autumn1-160x120.png 160w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><figcaption>a couple of leaves<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"320\" height=\"240\" src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/11\/autumn2.png\" alt=\"a small black screen images with text in the centre: autumn in canada scruss, 2021-11 just watch ... with four red\/yellow\/orange maple leaves sitting on top of it\" class=\"wp-image-16928\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/11\/autumn2.png 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/11\/autumn2-160x120.png 160w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><figcaption>more leaves<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"320\" height=\"240\" src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/11\/autumn3.png\" alt=\"a small black screen images with text in the centre: autumn in canada scruss, 2021-11 just watch ... with sixteen simulated fallen maple leaves mostly covering it\" class=\"wp-image-16927\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/11\/autumn3.png 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/11\/autumn3-160x120.png 160w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><figcaption>plenty of leaves<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"320\" height=\"240\" src=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/11\/autumn4.png\" alt=\"a small black screen image completely covered with many simulated fallen maple leaves\" class=\"wp-image-16926\" srcset=\"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/11\/autumn4.png 320w, https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/11\/autumn4-160x120.png 160w\" sizes=\"auto, (max-width: 320px) 100vw, 320px\" \/><figcaption>far too many  leaves<\/figcaption><\/figure><\/div>\n\n\n\n<p>The biggest thing that tripped me up was that PicoMite BASIC starts arrays at 0. <strong>OPTION BASE 1<\/strong> fixes that oversight. It would have been nice to have OpenProcessing&#8217;s HSV colour space, and an editor that could handle lines longer than 80 characters that didn&#8217;t threaten to bomb out if you hit the <strong>End<\/strong> key, but it&#8217;ll serve.<\/p>\n\n\n\n<p>Source below:<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: vb; title: ; notranslate\" title=\"\">\n&#039; autumn in canada\n&#039; scruss, 2021-11\n&#039; a take on my https:\/\/openprocessing.org\/sketch\/995420 for picomite\n\nOPTION base 1\nRANDOMIZE TIMER\n&#039; *** initialize polar coords of leaf polygon and colour array\nDIM leaf_rad(24), leaf_ang(24), px%(24), py%(24)\nFOR i=1 TO 24\n    READ leaf_rad(i)\nNEXT i\nFOR i=1 TO 24\n    READ x\n    leaf_ang(i)=RAD(x)\nNEXT i\n\nDIM integer c%(8)\nFOR i=1 TO 8\n    READ r%, g%, b%\n    c%(i)=RGB(r%,g%,b%)\nNEXT i\n\n&#039; *** set up some limits\nmin_scale%=INT(MIN(MM.HRES, MM.VRES)\/8)\nmax_scale%=INT(MIN(MM.HRES, MM.VRES)\/6)\nmin_angle=-30\nmax_angle=30\nmin_x%=min_scale%\nmin_y%=min_x%\nmax_x%=MM.HRES - min_x%\nmax_y%=MM.VRES - min_y%\n\nCLS\nTEXT MM.HRES\/2, INT(MM.VRES\/3), &quot;autumn in canada&quot;, &quot;CM&quot;\nTEXT MM.HRES\/2, INT(MM.VRES\/2), &quot;scruss, 2021-11&quot;, &quot;CM&quot;\nTEXT MM.HRES\/2, INT(2*MM.VRES\/3), &quot;just watch ...&quot;, &quot;CM&quot;\n\nkt%=0\nDO\n    cx% = min_x% + INT(RND * (max_x% - min_x%))\n    cy% = min_y% + INT(RND * (max_y% - min_y%))\n    angle = min_angle + RND * (max_angle - min_angle)\n    sc% = min_scale% + INT(RND * (max_scale% - min_scale%))\n    col% = 1 + INT(RND * 7)\n    leaf cx%, cy%, sc%, angle, c%(7), c%(col%)\n    kt% = kt% + 1\nLOOP UNTIL kt% &gt;= 1024\n\nEND\n\nSUB leaf x%, y%, scale%, angle, outline%, fill%\n    FOR i=1 TO 24\n        px%(i) = INT(x% + scale% * leaf_rad(i) * COS(RAD(angle)+leaf_ang(i)))\n        py%(i) = INT(y% - scale% * leaf_rad(i) * SIN(RAD(angle)+leaf_ang(i)))\n    NEXT i\n    POLYGON 24, px%(), py%(), outline%, fill%\nEND SUB\n\n&#039; radii\nDATA 0.536, 0.744, 0.608, 0.850, 0.719\nDATA 0.836, 0.565, 0.589, 0.211, 0.660, 0.515\nDATA 0.801, 0.515, 0.660, 0.211, 0.589, 0.565\nDATA 0.836, 0.719, 0.850, 0.608, 0.744, 0.536, 1.000\n&#039; angles\nDATA 270.000, 307.249, 312.110, 353.267, 356.540\nDATA 16.530, 18.774, 33.215, 3.497, 60.659, 72.514\nDATA 90.000, 107.486, 119.341, 176.503, 146.785, 161.226\nDATA 163.470, 183.460, 186.733, 227.890, 232.751, 270.000, 270.000\n&#039; leaf colours\nDATA 255,0,0, 255,36,0, 255,72,0, 255,109,0\nDATA 255,145,0, 255,182,0, 255,218,0, 255,255,0\n<\/pre><\/div>\n\n\n<p>You could probably use AUTOSAVE and paste the text into the PicoMite REPL. I used an <a href=\"https:\/\/www.simcoe-diy.ca\/product-page\/eyewink-240x320-2-8-spi-tft-lcd-touch-panel-serial-port-module\">ILI9341<\/a> SPI <a href=\"https:\/\/www.simcoe-diy.ca\/product-page\/eyewink-240x320-2-8-spi-tft-lcd-touch-panel-serial-port-module\">TFT LCD Touch Panel<\/a> with my Raspberry Pi Pico along with some rather messy breadboard wiring.<\/p>\n\n\n\n<p><strong>Fun fact<\/strong>: the maple leaf polygon points are derived from the official definition of the flag of Canada.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So I ported autumn in canada from OpenProcessing to PicoMite BASIC on the Raspberry Pi Pico: The biggest thing that tripped me up was that PicoMite BASIC starts arrays at 0. OPTION BASE 1 fixes that oversight. It would have been nice to have OpenProcessing&#8217;s HSV colour space, and an editor that could handle lines [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":16928,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Autumn in Canada: PicoMite version - lots and lots of leaves in a tiny screen","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,2,10],"tags":[2062,1200,2208,3299,3258,3300,2541,2510],"class_list":["post-16925","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-computers-suck","category-goatee-stroking-musing-or-something","category-o-canada","tag-basic","tag-canada","tag-electronics","tag-mmbasic","tag-pico","tag-picomite","tag-processing","tag-raspberrypi"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/scruss.com\/wordpress\/wp-content\/uploads\/2021\/11\/autumn2.png","jetpack_shortlink":"https:\/\/wp.me\/pQNZZ-4oZ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/16925","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=16925"}],"version-history":[{"count":3,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/16925\/revisions"}],"predecessor-version":[{"id":16934,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/posts\/16925\/revisions\/16934"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/media\/16928"}],"wp:attachment":[{"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/media?parent=16925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/categories?post=16925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/scruss.com\/blog\/wp-json\/wp\/v2\/tags?post=16925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}