{"id":1614,"date":"2020-01-21T10:31:19","date_gmt":"2020-01-21T10:31:19","guid":{"rendered":"https:\/\/ofalcao.pt\/blog\/?p=1614"},"modified":"2020-01-21T13:25:42","modified_gmt":"2020-01-21T13:25:42","slug":"1614","status":"publish","type":"post","link":"https:\/\/ofalcao.pt\/blog\/2020\/1614","title":{"rendered":"First useful version"},"content":{"rendered":"<div class=\"seriesmeta\">This post is part 3 of 3 of \u00a0<a href=\"https:\/\/ofalcao.pt\/blog\/series\/barcode\" class=\"series-357\" title=\"barcode\">barcode<\/a><\/div>\n<p>Added a few more lines to my first python script in order to achieve &#8216;Record and Play&#8217; functionality, like the original LEGO Code Pilot.<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"EV3 Code Pilot v2\" width=\"840\" height=\"473\" src=\"https:\/\/www.youtube.com\/embed\/zMmU8oCirgU?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p>Also change a bit the structure of the dicitionary, adding the code to execute to each &#8220;barcode item&#8221;. So the recording part is just adding &#8220;items&#8221; to a list and the playing is just a loop through the list, picking the code and executing it with the &#8216;exec&#8217; function (kudos to Daniel Walton).<\/p>\n\n\n\n<p>So &#8216;codepilot03.py&#8217; is now able to record an undefined number of steps and execute them in a row. And since the barcode scanner is fully Plug and Play we can detach it and reattach it between runs (and since wi-fi is not needed, we can also remove the clumsy USB hub).<\/p>\n\n\n\n<p>Next version will have an extended &#8220;language set&#8221;.<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"seriesmeta\">This post is part 3  of 3 of \u00a0<a href=\"https:\/\/ofalcao.pt\/blog\/series\/barcode\" class=\"series-357\" title=\"barcode\">barcode<\/a><\/div><p>Added a few more lines to my first python script in order to achieve &#8216;Record and Play&#8217; functionality, like the original LEGO Code Pilot. Also change a bit the structure of the dicitionary, adding the code to execute to each &#8220;barcode item&#8221;. So the recording part is just adding &#8220;items&#8221; to a list and the &hellip; <a href=\"https:\/\/ofalcao.pt\/blog\/2020\/1614\" class=\"more-link\">Continuar a ler<span class=\"screen-reader-text\"> &#8220;First useful version&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"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","enabled":false},"version":2}},"categories":[1],"tags":[],"series":[357],"class_list":["post-1614","post","type-post","status-publish","format-standard","hentry","category-sem-categoria","series-barcode"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/s2Mhyv-1614","_links":{"self":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/1614","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/comments?post=1614"}],"version-history":[{"count":0,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/posts\/1614\/revisions"}],"wp:attachment":[{"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/media?parent=1614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/categories?post=1614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/tags?post=1614"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/ofalcao.pt\/blog\/wp-json\/wp\/v2\/series?post=1614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}