{"id":63,"date":"2015-11-13T16:04:05","date_gmt":"2015-11-13T16:04:05","guid":{"rendered":"http:\/\/kennethrowe.com\/Blog\/?p=63"},"modified":"2015-11-17T00:19:42","modified_gmt":"2015-11-17T00:19:42","slug":"arduino-motor-shield-issue","status":"publish","type":"post","link":"http:\/\/kennethrowe.com\/Blog\/arduino-motor-shield-issue\/","title":{"rendered":"Arduino Motor Shield Issue"},"content":{"rendered":"<p>This will be my first engineering post, as I work on merging my interest in imagery with electrical engineering<\/p>\n<p>I&#8217;m having an issue with my new Arduino Uno and the Arduino Motor Shield R3.<\/p>\n<p>UPDATE:  I believe the problem is fixed with some help from the Arduino board. There was a mistake in the code where I didn&#8217;t set the direction pins to output.  Also it looks like I might have a power problems as well that will hopefully be solved with a new battery on order.  I also started a project page for updates on this.<\/p>\n<p>Here is a link to the video showing what is going.<\/p>\n<p><span class=\"embed-youtube\" style=\"text-align:center; display: block;\"><iframe loading=\"lazy\" class=\"youtube-player\" width=\"1180\" height=\"664\" src=\"https:\/\/www.youtube.com\/embed\/OG2LaANGkgM?version=3&#038;rel=1&#038;showsearch=0&#038;showinfo=1&#038;iv_load_policy=1&#038;fs=1&#038;hl=en-US&#038;autohide=2&#038;wmode=transparent\" allowfullscreen=\"true\" style=\"border:0;\" sandbox=\"allow-scripts allow-same-origin allow-popups allow-presentation allow-popups-to-escape-sandbox\"><\/iframe><\/span><\/p>\n<p>Here is the code<\/p>\n<p><code>\/*<br \/>\nMotor Test Drive<br \/>\n*\/<\/p>\n<p>\/\/Motor A Config<br \/>\nconst int<br \/>\nPWM_A = 3,<br \/>\nDIR_A = 12,<br \/>\nBRAKE_A = 9;<\/p>\n<p>\/\/Motor A Config<br \/>\nconst int<br \/>\nPWM_B = 11,<br \/>\nDIR_B = 13,<br \/>\nBRAKE_B = 8;<\/p>\n<p>void setup()<br \/>\n{<br \/>\npinMode(PWM_A, OUTPUT);<br \/>\npinMode(BRAKE_A, OUTPUT);<br \/>\npinMode(DIR_A, OUTPUT);<br \/>\npinMode(PWM_B, OUTPUT);<br \/>\npinMode(BRAKE_B, OUTPUT);<br \/>\npinMode(DIR_B, OUTPUT);<\/p>\n<p>Serial.begin(9600);<\/p>\n<p>digitalWrite(BRAKE_A, LOW); \/\/ setting brake LOW disable motor brake<br \/>\ndigitalWrite(DIR_A, HIGH); \/\/ setting direction to HIGH the motor will spin forward<br \/>\ndigitalWrite(BRAKE_B, LOW); \/\/ setting brake LOW disable motor brake<br \/>\ndigitalWrite(DIR_B, HIGH); \/\/ setting direction to HIGH the motor will spin forward;<\/p>\n<p>\/\/int speed = 0;<br \/>\nfor (int i = 1; i &lt; 255; i++)<br \/>\n{<br \/>\nanalogWrite(PWM_A, i);<br \/>\ndelay(50);<br \/>\n}<\/p>\n<p>analogWrite(PWM_A, 0);<br \/>\ndelay(1000);<\/p>\n<p>for (int i = 1; i &lt; 255; i++)<br \/>\n{<br \/>\nanalogWrite(PWM_B, i);<br \/>\ndelay(50);<br \/>\n}<\/p>\n<p>analogWrite(PWM_B, 0);<br \/>\ndelay(1000);<\/p>\n<p>for (int i = 1; i &lt; 255; i++)<br \/>\n{<br \/>\nanalogWrite(PWM_A, i);<br \/>\nanalogWrite(PWM_B, i);<br \/>\ndelay(50);<br \/>\n}<\/p>\n<p>analogWrite(PWM_A, 0);<br \/>\nanalogWrite(PWM_B, 0);<\/p>\n<p>}<\/p>\n<p>void loop()<br \/>\n{<br \/>\n<\/code><br \/>\n}<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This will be my first engineering post, as I work on merging my interest in imagery with electrical engineering I&#8217;m having an issue with my new Arduino Uno and the Arduino Motor Shield R3. UPDATE: I believe the problem is fixed with some help from the Arduino board. There was a mistake in the code [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":68,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"video","meta":{"nf_dc_page":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_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":[13],"tags":[],"class_list":{"0":"post-63","1":"post","2":"type-post","3":"status-publish","4":"format-video","5":"has-post-thumbnail","6":"hentry","7":"category-engineering","8":"post_format-post-format-video","10":"fallback-thumbnail"},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/kennethrowe.com\/Blog\/wp-content\/uploads\/2015\/11\/IMG_1669-e1447431214854.jpg?fit=3264%2C2448","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p5YiG5-11","_links":{"self":[{"href":"http:\/\/kennethrowe.com\/Blog\/wp-json\/wp\/v2\/posts\/63","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/kennethrowe.com\/Blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kennethrowe.com\/Blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kennethrowe.com\/Blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/kennethrowe.com\/Blog\/wp-json\/wp\/v2\/comments?post=63"}],"version-history":[{"count":1,"href":"http:\/\/kennethrowe.com\/Blog\/wp-json\/wp\/v2\/posts\/63\/revisions"}],"predecessor-version":[{"id":89,"href":"http:\/\/kennethrowe.com\/Blog\/wp-json\/wp\/v2\/posts\/63\/revisions\/89"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/kennethrowe.com\/Blog\/wp-json\/wp\/v2\/media\/68"}],"wp:attachment":[{"href":"http:\/\/kennethrowe.com\/Blog\/wp-json\/wp\/v2\/media?parent=63"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kennethrowe.com\/Blog\/wp-json\/wp\/v2\/categories?post=63"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kennethrowe.com\/Blog\/wp-json\/wp\/v2\/tags?post=63"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}