{"id":818,"date":"2013-11-14T13:13:19","date_gmt":"2013-11-14T21:13:19","guid":{"rendered":"http:\/\/www.techykids.com\/?p=818"},"modified":"2013-11-14T13:13:19","modified_gmt":"2013-11-14T21:13:19","slug":"drawing-with-iterations","status":"publish","type":"post","link":"https:\/\/techykids.com\/staging\/3266\/archives\/818","title":{"rendered":"Thymio Drawing Patterns with Iterations Activity"},"content":{"rendered":"<h1>Activity:<\/h1>\n<p>Turn Thymio into a drawing machine by placing a thin marker in the pen holder!<\/p>\n<h1>How to:<\/h1>\n<ol>\n<li>Copy and paste the code used in the video into Aseba Studio:<\/li>\n<\/ol>\n<p><span style=\"text-decoration: underline;\"><strong>Drawing #1<\/strong><\/span><\/p>\n<pre><code>var itera = 0\n\nonevent temperature #Thymio updates temperature value at once per second.  You can replace this line with the following two to change time intervals\n#timer.period[0] = 1000\n#onevent timer0 \nitera = itera + 1\nif itera==1 then\n    motor.left.target = 230\n    motor.right.target = -120\nend\nif itera==4 then\n    motor.left.target = 80\n    motor.right.target = 80\nend\nif itera==7 then\n    itera = 0\nend<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-822\" src=\"https:\/\/www.techykids.com\/wp-content\/uploads\/2013\/11\/flower-drawing1.jpg\" alt=\"\" width=\"700\" height=\"681\" \/><br \/>\n<span style=\"text-decoration: underline;\"><strong>Drawing #2<\/strong><\/span><\/p>\n<pre><code>var itera = 0\n\nonevent temperature\nitera = itera + 1\nif itera==1 then\n    motor.left.target = 100\n    motor.right.target = 90\nend\nif itera==4 then\n    motor.left.target = -100\n    motor.right.target = -70\nend\nif itera==7 then\n    itera = 0\nend<\/code><\/pre>\n<p><a href=\"http:\/\/www.techykids.com\/wp-content\/uploads\/2013\/11\/pattern-2.jpg\"><img loading=\"lazy\" decoding=\"async\" loading=\"lazy\" class=\"alignright size-full wp-image-829\" src=\"http:\/\/www.techykids.com\/wp-content\/uploads\/2013\/11\/pattern-2.jpg\" alt=\"pattern 2\" width=\"700\" height=\"665\" \/><\/a><\/p>\n<p><span style=\"text-decoration: underline;\"><strong>Drawing #3<\/strong><\/span><\/p>\n<p><strong>This program will have Thymio draw six hexagons around a center \u2014 to make a sort of flower.\u00a0 \u00a0<\/strong>See Tom&#8217;s Full Project here:\u00a0<a href=\"https:\/\/www.techykids.com\/hexagon-flower-2\/\">https:\/\/www.techykids.com\/hexagon-flower-2\/<\/a><\/p>\n<pre><code>\n#* SIX PETAL HEXAGON FLOWER \n\n This program will draw six overlapping hexagons\naround a center. Each part of the program will be\nexplained in green letters - just like these! *#\n\n # The very first thing (ALWAYS) is to set up your variables. \n\n var count = 0 \nvar sides = 0     # Counts how many sides have been drawn. \nvar petals = 0    # Counts how many petals have been drawn. \n\n timer.period[0] = 2000     # A timer 'click' will happen every 2 seconds. \n\n onevent timer0\ncount = count + 1    # Keeps track of how many timer 'clicks.' \n\n #* Don't be afraid to use SUBROUTINES. Computers love them because when\nthey have to do the same thing over and over, calling a subroutine \nis the easiest way - so YOU don't have to write the same code over and over. \nIn this program, all SUBROUTINES appear at the bottom. \nThey will be called all along the way as the program needs them. *#\n\n #* It takes 2 actions to draw one side: drawing the line and turning.\nSo, it will take twelve 'counts' to make each complete hexagon.\n\n Here we call a subroutine to draw one side of a hexagon. *# \nif count == 1 or count == 3 or count == 5 \nor count == 7 or count == 9 or count == 11 then\ncallsub draw_side\nend\n\n #* After each side is drawn, a different subroutine turns Thymio clockwise.\nHere we call a subroutine to turn Thymio 60 degrees to the right. *#\n\n if count == 2 or count == 4 or count == 6 \nor count == 8 or count == 10 or count == 12 then\ncallsub turn \nend\n\n #* It takes six combination events [a side + a turn] (a total of 12) to make one \"petal,\" so after finishing each petal (when the count reaches 13) it resets its counter to 0 and starts counting again. *#\n \nif count == 13 then\ncall leds.top(255, 0, 255)    # The top turns purple when each petal is done.\nmotor.left.target = 73 \nmotor.right.target = -72\npetals = petals + 1    # Counting petals. 6 petals = DONE! \ncount = 0    # Reset counter. \nend \n\n if petals &gt;= 6 then      # STOP altogether after drawing 6 petals \ncall leds.top(255,255,255)     # When the top turns white, you're done. \nmotor.left.target = 0\nmotor.right.target = 0\nend\n\n\n #* The SUBROUTINES ----------------------------------------------------- \n\n #*DRAW one line each time this subroutine is called. \nTop color is Green *#\nsub draw_side \ncall leds.top(0, 255, 0)\nmotor.left.target = 60\nmotor.right.target = 60\nreturn\n\n #* TURN 60 degrees to the right each time this subroutine is called\nTop color is Red *#\nsub turn \ncall leds.top(255, 0, 0)\nmotor.left.target = 73\nmotor.right.target = -72\nreturn\n<\/code><\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" loading=\"lazy\" class=\"wp-image-3642 alignright\" src=\"https:\/\/www.techykids.com\/wp-content\/uploads\/2016\/08\/Hexagon_Flower-3.jpg\" alt=\"\" width=\"628\" height=\"463\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Activity: Turn Thymio into a drawing machine by placing a thin marker in the pen holder! How to: Copy and paste the code used in the video into Aseba Studio: Drawing #1 var itera = 0 onevent temperature #Thymio updates temperature value at once per second. You can replace this line with the following two &hellip;<\/p>\n<p class=\"read-more\"> <a class=\"\" href=\"https:\/\/techykids.com\/staging\/3266\/archives\/818\"> <span class=\"screen-reader-text\">Thymio Drawing Patterns with Iterations Activity<\/span> Read More &raquo;<\/a><\/p>\n","protected":false},"author":2,"featured_media":83371,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"default","ast-global-header-display":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","footnotes":""},"categories":[17],"tags":[62,180],"class_list":["post-818","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thymio-projects","tag-activity","tag-drawing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Thymio Drawing Patterns with Iterations Activity - TechyKids.com<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/techykids.com\/staging\/3266\/archives\/818\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Thymio Drawing Patterns with Iterations Activity - TechyKids.com\" \/>\n<meta property=\"og:description\" content=\"Activity: Turn Thymio into a drawing machine by placing a thin marker in the pen holder! How to: Copy and paste the code used in the video into Aseba Studio: Drawing #1 var itera = 0 onevent temperature #Thymio updates temperature value at once per second. You can replace this line with the following two &hellip; Thymio Drawing Patterns with Iterations Activity Read More &raquo;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/techykids.com\/staging\/3266\/archives\/818\" \/>\n<meta property=\"og:site_name\" content=\"TechyKids.com\" \/>\n<meta property=\"article:published_time\" content=\"2013-11-14T21:13:19+00:00\" \/>\n<meta name=\"author\" content=\"Sharon\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sharon\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/techykids.com\/staging\/3266\/archives\/818#article\",\"isPartOf\":{\"@id\":\"https:\/\/techykids.com\/staging\/3266\/archives\/818\"},\"author\":{\"name\":\"Sharon\",\"@id\":\"https:\/\/techykids.com\/#\/schema\/person\/e4d353eee11ff5668cb913fa9d9ffbe4\"},\"headline\":\"Thymio Drawing Patterns with Iterations Activity\",\"datePublished\":\"2013-11-14T21:13:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/techykids.com\/staging\/3266\/archives\/818\"},\"wordCount\":67,\"publisher\":{\"@id\":\"https:\/\/techykids.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/techykids.com\/staging\/3266\/archives\/818#primaryimage\"},\"thumbnailUrl\":\"https:\/\/techykids.com\/staging\/3266\/wp-content\/uploads\/2013\/11\/flower-drawing1.jpg\",\"keywords\":[\"Activity\",\"Drawing\"],\"articleSection\":[\"Thymio\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/techykids.com\/staging\/3266\/archives\/818\",\"url\":\"https:\/\/techykids.com\/staging\/3266\/archives\/818\",\"name\":\"Thymio Drawing Patterns with Iterations Activity - TechyKids.com\",\"isPartOf\":{\"@id\":\"https:\/\/techykids.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/techykids.com\/staging\/3266\/archives\/818#primaryimage\"},\"image\":{\"@id\":\"https:\/\/techykids.com\/staging\/3266\/archives\/818#primaryimage\"},\"thumbnailUrl\":\"https:\/\/techykids.com\/staging\/3266\/wp-content\/uploads\/2013\/11\/flower-drawing1.jpg\",\"datePublished\":\"2013-11-14T21:13:19+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/techykids.com\/staging\/3266\/archives\/818#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/techykids.com\/staging\/3266\/archives\/818\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/techykids.com\/staging\/3266\/archives\/818#primaryimage\",\"url\":\"https:\/\/techykids.com\/staging\/3266\/wp-content\/uploads\/2013\/11\/flower-drawing1.jpg\",\"contentUrl\":\"https:\/\/techykids.com\/staging\/3266\/wp-content\/uploads\/2013\/11\/flower-drawing1.jpg\",\"width\":700,\"height\":681},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/techykids.com\/staging\/3266\/archives\/818#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/techykids.com\/staging\/3266\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Thymio Drawing Patterns with Iterations Activity\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/techykids.com\/#website\",\"url\":\"https:\/\/techykids.com\/\",\"name\":\"TechyKids.com\",\"description\":\"Get Inspired.\",\"publisher\":{\"@id\":\"https:\/\/techykids.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/techykids.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/techykids.com\/#organization\",\"name\":\"TechyKids.com\",\"url\":\"https:\/\/techykids.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/techykids.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/techykids.com\/staging\/3266\/wp-content\/uploads\/2013\/05\/techykids1-2.png\",\"contentUrl\":\"https:\/\/techykids.com\/staging\/3266\/wp-content\/uploads\/2013\/05\/techykids1-2.png\",\"width\":300,\"height\":104,\"caption\":\"TechyKids.com\"},\"image\":{\"@id\":\"https:\/\/techykids.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/techykids.com\/#\/schema\/person\/e4d353eee11ff5668cb913fa9d9ffbe4\",\"name\":\"Sharon\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/techykids.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/6d7fcd9f270d4b5e8e68ff1ebe130252a70cafed7163951b2805d154ba9e8ab5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/6d7fcd9f270d4b5e8e68ff1ebe130252a70cafed7163951b2805d154ba9e8ab5?s=96&d=mm&r=g\",\"caption\":\"Sharon\"},\"url\":\"https:\/\/techykids.com\/staging\/3266\/archives\/author\/sharontk\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Thymio Drawing Patterns with Iterations Activity - TechyKids.com","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:\/\/techykids.com\/staging\/3266\/archives\/818","og_locale":"en_US","og_type":"article","og_title":"Thymio Drawing Patterns with Iterations Activity - TechyKids.com","og_description":"Activity: Turn Thymio into a drawing machine by placing a thin marker in the pen holder! How to: Copy and paste the code used in the video into Aseba Studio: Drawing #1 var itera = 0 onevent temperature #Thymio updates temperature value at once per second. You can replace this line with the following two &hellip; Thymio Drawing Patterns with Iterations Activity Read More &raquo;","og_url":"https:\/\/techykids.com\/staging\/3266\/archives\/818","og_site_name":"TechyKids.com","article_published_time":"2013-11-14T21:13:19+00:00","author":"Sharon","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Sharon","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/techykids.com\/staging\/3266\/archives\/818#article","isPartOf":{"@id":"https:\/\/techykids.com\/staging\/3266\/archives\/818"},"author":{"name":"Sharon","@id":"https:\/\/techykids.com\/#\/schema\/person\/e4d353eee11ff5668cb913fa9d9ffbe4"},"headline":"Thymio Drawing Patterns with Iterations Activity","datePublished":"2013-11-14T21:13:19+00:00","mainEntityOfPage":{"@id":"https:\/\/techykids.com\/staging\/3266\/archives\/818"},"wordCount":67,"publisher":{"@id":"https:\/\/techykids.com\/#organization"},"image":{"@id":"https:\/\/techykids.com\/staging\/3266\/archives\/818#primaryimage"},"thumbnailUrl":"https:\/\/techykids.com\/staging\/3266\/wp-content\/uploads\/2013\/11\/flower-drawing1.jpg","keywords":["Activity","Drawing"],"articleSection":["Thymio"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/techykids.com\/staging\/3266\/archives\/818","url":"https:\/\/techykids.com\/staging\/3266\/archives\/818","name":"Thymio Drawing Patterns with Iterations Activity - TechyKids.com","isPartOf":{"@id":"https:\/\/techykids.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/techykids.com\/staging\/3266\/archives\/818#primaryimage"},"image":{"@id":"https:\/\/techykids.com\/staging\/3266\/archives\/818#primaryimage"},"thumbnailUrl":"https:\/\/techykids.com\/staging\/3266\/wp-content\/uploads\/2013\/11\/flower-drawing1.jpg","datePublished":"2013-11-14T21:13:19+00:00","breadcrumb":{"@id":"https:\/\/techykids.com\/staging\/3266\/archives\/818#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/techykids.com\/staging\/3266\/archives\/818"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techykids.com\/staging\/3266\/archives\/818#primaryimage","url":"https:\/\/techykids.com\/staging\/3266\/wp-content\/uploads\/2013\/11\/flower-drawing1.jpg","contentUrl":"https:\/\/techykids.com\/staging\/3266\/wp-content\/uploads\/2013\/11\/flower-drawing1.jpg","width":700,"height":681},{"@type":"BreadcrumbList","@id":"https:\/\/techykids.com\/staging\/3266\/archives\/818#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/techykids.com\/staging\/3266\/"},{"@type":"ListItem","position":2,"name":"Thymio Drawing Patterns with Iterations Activity"}]},{"@type":"WebSite","@id":"https:\/\/techykids.com\/#website","url":"https:\/\/techykids.com\/","name":"TechyKids.com","description":"Get Inspired.","publisher":{"@id":"https:\/\/techykids.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/techykids.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/techykids.com\/#organization","name":"TechyKids.com","url":"https:\/\/techykids.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techykids.com\/#\/schema\/logo\/image\/","url":"https:\/\/techykids.com\/staging\/3266\/wp-content\/uploads\/2013\/05\/techykids1-2.png","contentUrl":"https:\/\/techykids.com\/staging\/3266\/wp-content\/uploads\/2013\/05\/techykids1-2.png","width":300,"height":104,"caption":"TechyKids.com"},"image":{"@id":"https:\/\/techykids.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/techykids.com\/#\/schema\/person\/e4d353eee11ff5668cb913fa9d9ffbe4","name":"Sharon","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/techykids.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6d7fcd9f270d4b5e8e68ff1ebe130252a70cafed7163951b2805d154ba9e8ab5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6d7fcd9f270d4b5e8e68ff1ebe130252a70cafed7163951b2805d154ba9e8ab5?s=96&d=mm&r=g","caption":"Sharon"},"url":"https:\/\/techykids.com\/staging\/3266\/archives\/author\/sharontk"}]}},"_links":{"self":[{"href":"https:\/\/techykids.com\/staging\/3266\/wp-json\/wp\/v2\/posts\/818","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techykids.com\/staging\/3266\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techykids.com\/staging\/3266\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techykids.com\/staging\/3266\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/techykids.com\/staging\/3266\/wp-json\/wp\/v2\/comments?post=818"}],"version-history":[{"count":0,"href":"https:\/\/techykids.com\/staging\/3266\/wp-json\/wp\/v2\/posts\/818\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/techykids.com\/staging\/3266\/wp-json\/wp\/v2\/media\/83371"}],"wp:attachment":[{"href":"https:\/\/techykids.com\/staging\/3266\/wp-json\/wp\/v2\/media?parent=818"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techykids.com\/staging\/3266\/wp-json\/wp\/v2\/categories?post=818"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techykids.com\/staging\/3266\/wp-json\/wp\/v2\/tags?post=818"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}