{"id":458,"date":"2021-12-11T16:26:18","date_gmt":"2021-12-11T16:26:18","guid":{"rendered":"http:\/\/www.thelemmingfarm.uk\/?p=458"},"modified":"2021-12-11T16:27:26","modified_gmt":"2021-12-11T16:27:26","slug":"updating-motor-controller-code","status":"publish","type":"post","link":"http:\/\/www.thelemmingfarm.uk\/?p=458","title":{"rendered":"Updating Motor Controller code"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">We created a python class to drive the L298N Motor Driver&#8217;s used in a previous robot. Each of the L298N&#8217;s could drive 2 channels, but how it did the driving is different to the new MDD10A&#8217;s. This task was to modify that class for the new boards.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<p class=\"wp-block-paragraph\">The existing motor driver had a pin for forwards and another for backwards. This was duplicated for the two channels.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Driving the motor forwards was setting the forwards pin to high. To change the speed of the backwards or forwards motion the relevant pin had PWM applied to it. <\/p>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.electroduino.com\/wp-content\/uploads\/2020\/07\/L298N-Motor-Driver-Module-Pin-Diagram-300x197.jpg\" alt=\"\" width=\"541\" height=\"355\"\/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-8f761849 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:66.66%\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"706\" height=\"501\" src=\"http:\/\/www.thelemmingfarm.uk\/wp-content\/uploads\/2021\/12\/MDD10A_Control.png\" alt=\"\" class=\"wp-image-459\" srcset=\"http:\/\/www.thelemmingfarm.uk\/wp-content\/uploads\/2021\/12\/MDD10A_Control.png 706w, http:\/\/www.thelemmingfarm.uk\/wp-content\/uploads\/2021\/12\/MDD10A_Control-300x213.png 300w\" sizes=\"auto, (max-width: 706px) 100vw, 706px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:33.33%\">\n<p class=\"wp-block-paragraph\">The new boards behave differently. The have a single pin for backward and forward depending on whether it is 1 or 0.  There is a second pin that has a PWM input to control the speed of the movement. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The instructions provide a truth table showing how this works.<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>We created a python class to drive the L298N Motor Driver&#8217;s used in a previous robot. Each of the L298N&#8217;s could drive 2 channels, but<\/p>\n","protected":false},"author":1,"featured_media":444,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[11],"tags":[],"class_list":["post-458","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coding"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Updating Motor Controller code - The Lemming Farm<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"http:\/\/www.thelemmingfarm.uk\/?p=458\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Updating Motor Controller code - The Lemming Farm\" \/>\n<meta property=\"og:description\" content=\"We created a python class to drive the L298N Motor Driver&#8217;s used in a previous robot. Each of the L298N&#8217;s could drive 2 channels, but\" \/>\n<meta property=\"og:url\" content=\"http:\/\/www.thelemmingfarm.uk\/?p=458\" \/>\n<meta property=\"og:site_name\" content=\"The Lemming Farm\" \/>\n<meta property=\"article:published_time\" content=\"2021-12-11T16:26:18+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-12-11T16:27:26+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/www.thelemmingfarm.uk\/wp-content\/uploads\/2021\/12\/20211208_220815_cropped-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"640\" \/>\n\t<meta property=\"og:image:height\" content=\"629\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"matt\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"matt\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/?p=458#article\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/?p=458\"},\"author\":{\"name\":\"matt\",\"@id\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/#\\\/schema\\\/person\\\/ad3da4bf1895ba680ee4c6a0cdcfe5c3\"},\"headline\":\"Updating Motor Controller code\",\"datePublished\":\"2021-12-11T16:26:18+00:00\",\"dateModified\":\"2021-12-11T16:27:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/?p=458\"},\"wordCount\":152,\"image\":{\"@id\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/?p=458#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/20211208_220815_cropped-1.jpg\",\"articleSection\":[\"Coding\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/?p=458\",\"url\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/?p=458\",\"name\":\"Updating Motor Controller code - The Lemming Farm\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/?p=458#primaryimage\"},\"image\":{\"@id\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/?p=458#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/20211208_220815_cropped-1.jpg\",\"datePublished\":\"2021-12-11T16:26:18+00:00\",\"dateModified\":\"2021-12-11T16:27:26+00:00\",\"author\":{\"@id\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/#\\\/schema\\\/person\\\/ad3da4bf1895ba680ee4c6a0cdcfe5c3\"},\"breadcrumb\":{\"@id\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/?p=458#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"http:\\\/\\\/www.thelemmingfarm.uk\\\/?p=458\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/?p=458#primaryimage\",\"url\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/20211208_220815_cropped-1.jpg\",\"contentUrl\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/wp-content\\\/uploads\\\/2021\\\/12\\\/20211208_220815_cropped-1.jpg\",\"width\":640,\"height\":629},{\"@type\":\"BreadcrumbList\",\"@id\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/?p=458#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Updating Motor Controller code\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/#website\",\"url\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/\",\"name\":\"The Lemming Farm\",\"description\":\"An Entry to the Pi Wars Competition 2024\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Person\",\"@id\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/#\\\/schema\\\/person\\\/ad3da4bf1895ba680ee4c6a0cdcfe5c3\",\"name\":\"matt\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6384a0c4df2a2e69eff9a84163bce14869cb2bde2aa2d0757ccafb22cd711e2c?s=96&d=mm&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6384a0c4df2a2e69eff9a84163bce14869cb2bde2aa2d0757ccafb22cd711e2c?s=96&d=mm&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6384a0c4df2a2e69eff9a84163bce14869cb2bde2aa2d0757ccafb22cd711e2c?s=96&d=mm&r=pg\",\"caption\":\"matt\"},\"url\":\"http:\\\/\\\/www.thelemmingfarm.uk\\\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Updating Motor Controller code - The Lemming Farm","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":"http:\/\/www.thelemmingfarm.uk\/?p=458","og_locale":"en_GB","og_type":"article","og_title":"Updating Motor Controller code - The Lemming Farm","og_description":"We created a python class to drive the L298N Motor Driver&#8217;s used in a previous robot. Each of the L298N&#8217;s could drive 2 channels, but","og_url":"http:\/\/www.thelemmingfarm.uk\/?p=458","og_site_name":"The Lemming Farm","article_published_time":"2021-12-11T16:26:18+00:00","article_modified_time":"2021-12-11T16:27:26+00:00","og_image":[{"width":640,"height":629,"url":"http:\/\/www.thelemmingfarm.uk\/wp-content\/uploads\/2021\/12\/20211208_220815_cropped-1.jpg","type":"image\/jpeg"}],"author":"matt","twitter_card":"summary_large_image","twitter_misc":{"Written by":"matt","Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"http:\/\/www.thelemmingfarm.uk\/?p=458#article","isPartOf":{"@id":"http:\/\/www.thelemmingfarm.uk\/?p=458"},"author":{"name":"matt","@id":"http:\/\/www.thelemmingfarm.uk\/#\/schema\/person\/ad3da4bf1895ba680ee4c6a0cdcfe5c3"},"headline":"Updating Motor Controller code","datePublished":"2021-12-11T16:26:18+00:00","dateModified":"2021-12-11T16:27:26+00:00","mainEntityOfPage":{"@id":"http:\/\/www.thelemmingfarm.uk\/?p=458"},"wordCount":152,"image":{"@id":"http:\/\/www.thelemmingfarm.uk\/?p=458#primaryimage"},"thumbnailUrl":"http:\/\/www.thelemmingfarm.uk\/wp-content\/uploads\/2021\/12\/20211208_220815_cropped-1.jpg","articleSection":["Coding"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"http:\/\/www.thelemmingfarm.uk\/?p=458","url":"http:\/\/www.thelemmingfarm.uk\/?p=458","name":"Updating Motor Controller code - The Lemming Farm","isPartOf":{"@id":"http:\/\/www.thelemmingfarm.uk\/#website"},"primaryImageOfPage":{"@id":"http:\/\/www.thelemmingfarm.uk\/?p=458#primaryimage"},"image":{"@id":"http:\/\/www.thelemmingfarm.uk\/?p=458#primaryimage"},"thumbnailUrl":"http:\/\/www.thelemmingfarm.uk\/wp-content\/uploads\/2021\/12\/20211208_220815_cropped-1.jpg","datePublished":"2021-12-11T16:26:18+00:00","dateModified":"2021-12-11T16:27:26+00:00","author":{"@id":"http:\/\/www.thelemmingfarm.uk\/#\/schema\/person\/ad3da4bf1895ba680ee4c6a0cdcfe5c3"},"breadcrumb":{"@id":"http:\/\/www.thelemmingfarm.uk\/?p=458#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["http:\/\/www.thelemmingfarm.uk\/?p=458"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"http:\/\/www.thelemmingfarm.uk\/?p=458#primaryimage","url":"http:\/\/www.thelemmingfarm.uk\/wp-content\/uploads\/2021\/12\/20211208_220815_cropped-1.jpg","contentUrl":"http:\/\/www.thelemmingfarm.uk\/wp-content\/uploads\/2021\/12\/20211208_220815_cropped-1.jpg","width":640,"height":629},{"@type":"BreadcrumbList","@id":"http:\/\/www.thelemmingfarm.uk\/?p=458#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/www.thelemmingfarm.uk\/"},{"@type":"ListItem","position":2,"name":"Updating Motor Controller code"}]},{"@type":"WebSite","@id":"http:\/\/www.thelemmingfarm.uk\/#website","url":"http:\/\/www.thelemmingfarm.uk\/","name":"The Lemming Farm","description":"An Entry to the Pi Wars Competition 2024","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/www.thelemmingfarm.uk\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Person","@id":"http:\/\/www.thelemmingfarm.uk\/#\/schema\/person\/ad3da4bf1895ba680ee4c6a0cdcfe5c3","name":"matt","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/secure.gravatar.com\/avatar\/6384a0c4df2a2e69eff9a84163bce14869cb2bde2aa2d0757ccafb22cd711e2c?s=96&d=mm&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/6384a0c4df2a2e69eff9a84163bce14869cb2bde2aa2d0757ccafb22cd711e2c?s=96&d=mm&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6384a0c4df2a2e69eff9a84163bce14869cb2bde2aa2d0757ccafb22cd711e2c?s=96&d=mm&r=pg","caption":"matt"},"url":"http:\/\/www.thelemmingfarm.uk\/?author=1"}]}},"jetpack_featured_media_url":"http:\/\/www.thelemmingfarm.uk\/wp-content\/uploads\/2021\/12\/20211208_220815_cropped-1.jpg","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.thelemmingfarm.uk\/index.php?rest_route=\/wp\/v2\/posts\/458","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.thelemmingfarm.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.thelemmingfarm.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.thelemmingfarm.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.thelemmingfarm.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=458"}],"version-history":[{"count":2,"href":"http:\/\/www.thelemmingfarm.uk\/index.php?rest_route=\/wp\/v2\/posts\/458\/revisions"}],"predecessor-version":[{"id":461,"href":"http:\/\/www.thelemmingfarm.uk\/index.php?rest_route=\/wp\/v2\/posts\/458\/revisions\/461"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.thelemmingfarm.uk\/index.php?rest_route=\/wp\/v2\/media\/444"}],"wp:attachment":[{"href":"http:\/\/www.thelemmingfarm.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.thelemmingfarm.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=458"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.thelemmingfarm.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}