{"id":2950,"date":"2021-12-31T06:31:28","date_gmt":"2021-12-31T14:31:28","guid":{"rendered":"https:\/\/www.donluc.com\/?p=2950"},"modified":"2021-12-31T06:31:28","modified_gmt":"2021-12-31T14:31:28","slug":"project-12-robotics-easydriver-mk16","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=2950","title":{"rendered":"Project #12: Robotics &#8211; EasyDriver &#8211; Mk16"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-2950-1\" width=\"720\" height=\"480\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/12\/DL2112Mk06W.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/12\/DL2112Mk06W.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/12\/DL2112Mk06W.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p>#DonLucElectronics #DonLuc #Robotics #Arduino #Fio #XBee #Stepper #EasyDriver #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant<\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/12\/DL2112Mk06a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/12\/DL2112Mk06a.png\" alt=\"EasyDriver\" width=\"720\" height=\"791\" class=\"alignnone size-full wp-image-2952\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/12\/DL2112Mk06a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/12\/DL2112Mk06a-273x300.png 273w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/12\/DL2112Mk06b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/12\/DL2112Mk06b.png\" alt=\"EasyDriver\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-2953\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/12\/DL2112Mk06b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/12\/DL2112Mk06b-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/12\/DL2112Mk06c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/12\/DL2112Mk06c.png\" alt=\"EasyDriver\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-2954\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/12\/DL2112Mk06c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2021\/12\/DL2112Mk06c-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>Stepper Motor<\/strong><\/p>\n<p>A stepper motor, also known as step motor or stepping motor, is a brushless DC electric motor that divides a full rotation into a number of equal steps. The motor&#8217;s position can be commanded to move and hold at one of these steps without any position sensor for feedback, as long as the motor is correctly sized to the application in respect to torque and speed. Switched reluctance motors are very large stepping motors with a reduced pole count, and generally are closed-loop commutated. <\/p>\n<p><strong>EasyDriver &#8211; Stepper Motor Driver<\/strong><\/p>\n<p>The EasyDriver is a simple to use stepper motor driver, compatible with anything that can output a digital 0 to 5V pulse. The EasyDriver requires a 6V to 30V supply to power the motor and can power any voltage of stepper motor. The EasyDriver has an on board voltage regulator for the digital interface that can be set to 5V. Connect a 4-wire stepper motor and a microcontroller and you&#8217;ve got precision motor control! EasyDriver drives bi-polar motors, and motors wired as bi-polar.<\/p>\n<p><strong>DL2112Mk06<\/strong><\/p>\n<p>2 x Fio v3 &#8211; ATmega32U4<br \/>\n2 x XBee S1<br \/>\n2 x Lithium Ion Battery &#8211; 850mAh<br \/>\n1 x Thumb Joystick<br \/>\n1 x SparkFun Thumb Joystick Breakout<br \/>\n1 x Slide Pot (Small)<br \/>\n1 x Slide Potentiometer Knob<br \/>\n1 x RGB Smart NeoPixel<br \/>\n1 x Pololu Adjustable Step-Up Voltage Regulator U1V11A<br \/>\n2 x EasyDriver<br \/>\n2 x Small Stepper<br \/>\n1 x Nine Volt Battery<br \/>\n1 x 9V Battery Connector<br \/>\n1 x Half-Size Breadboard<br \/>\n1 x Full-Size Breadboard<br \/>\n1 x SparkFun Cerberus USB Cable<\/p>\n<p><strong>Fio v3 &#8211; ATmega32U4 &#8211; Transmitter<\/strong><\/p>\n<p><strong>XBee S1:<\/strong> Transmitter<\/p>\n<p><strong>CH Channel:<\/strong> C<br \/>\n<strong>PAN Id:<\/strong> 3333<br \/>\n<strong>SH Serial Number:<\/strong> 13A200<br \/>\n<strong>SL Serial Number:<\/strong> 40717A1F<br \/>\n<strong>CE Coordinator:<\/strong> Coordinator<br \/>\n<strong>BD:<\/strong> 9600<\/p>\n<p>RX0 &#8211; Digital 0<br \/>\nTX0 &#8211; Digital 1<br \/>\nPO0 &#8211; Analog A0<br \/>\nJY0 &#8211; Analog A1<br \/>\nJY1 &#8211; Analog A2<br \/>\nSE0 &#8211; Digital 16<br \/>\nVIN &#8211; +3.3V<br \/>\nGND &#8211; GND<\/p>\n<p><strong>DL2112Mk06t.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/* ***** Don Luc Electronics \u00a9 *****\r\nSoftware Version Information\r\nProject #12: Robotics - XBee S1 - Transmitter - Mk16\r\n12-06\r\nDL2112Mk06t.ino\r\n1 x Fio v3 - ATmega32U4\r\n1 x XBee S1\r\n1 x Lithium Ion Battery - 850mAh\r\n1 x Thumb Joystick\r\n1 x SparkFun Thumb Joystick Breakout\r\n1 x Slide Pot (Small)\r\n1 x Slide Potentiometer Knob\r\n1 x SparkFun Cerberus USB Cable\r\n*\/\r\n\r\n\/\/ Include the Library Code\r\n\/\/ EEPROM library to read and write EEPROM with unique ID for unit\r\n#include &lt;EEPROM.h&gt;\r\n\r\n\/\/ Communication\r\nunsigned long dTime = 200;\r\n\r\n\/\/ Slide Pot (Small)\r\n\/\/ Select the input pin for the slide pot\r\n\/\/ Power\r\nconst int iSP1 = A0;\r\n\/\/ Power to store the value\r\nint iPower = 0;\r\n\r\n\/\/ Connections to joystick\r\n\/\/ Vertical\r\nconst int VERT = A1;\r\n\/\/ Horizontal\r\nconst int HORIZ = A2;\r\n\/\/ Pushbutton\r\nconst int SEL = 16;\r\n\/\/ Initialize variables for analog and digital values\r\nint vertical;\r\nint horizontal;\r\nint select;\r\n\r\n\/\/ Software Version Information\r\n\/\/ Version\r\nString sver = &quot;12-16t&quot;;\r\n\/\/ Unit ID Information\r\n\/\/ UID\r\nString uid = &quot;&quot;;\r\n\r\nvoid loop()\r\n{\r\n\r\n  \/\/ Thumb Joystick\r\n  isThumbJoystick();\r\n    \r\n  \/\/ Process Message\r\n  isProcessMessage();\r\n\r\n  delay( dTime );\r\n  \r\n}\r\n<\/pre>\n<p><strong>getEEPROM.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ EEPROM\r\n\/\/ is UID\r\nvoid isUID()\r\n{\r\n  \r\n  \/\/ Is Unit ID\r\n  \/\/ UID\r\n  uid = &quot;&quot;;\r\n  for (int x = 0; x &lt; 5; x++)\r\n  {\r\n    uid = uid + char(EEPROM.read(x));\r\n  }\r\n  \r\n}\r\n<\/pre>\n<p><strong>getProcessMessage.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Process Message\r\n\/\/ isProcessMessage\r\nvoid isProcessMessage() {\r\n  \r\n   \/\/ Loop through serial buffer\r\n   \/\/ Print = &quot;&lt;&quot; + vertical + &quot;|&quot; + horizontal + &quot;|&quot; + select + &quot;|&quot; + iValue + &quot;|&quot; + sver + &quot;|&quot; + uid + &quot;*&quot;\r\n      \r\n   Serial1.print( &#039;&lt;&#039;  );\r\n   Serial1.print( vertical );\r\n   Serial1.print( &#039;|&#039; );\r\n   Serial1.print( horizontal );\r\n   Serial1.print( &#039;|&#039; );\r\n   Serial1.print( select );\r\n   Serial1.print( &#039;|&#039; );\r\n   Serial1.print( iPower );\r\n   Serial1.print( &#039;|&#039; );\r\n   Serial1.print( sver );\r\n   Serial1.print( &#039;|&#039; );\r\n   Serial1.print( uid );\r\n   Serial1.println( &#039;*&#039; );\r\n\r\n}\r\n<\/pre>\n<p><strong>getThumbJoystick.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Thumb Joystick\r\nvoid isThumbJoystick() {\r\n\r\n  \/\/ Read all values from the joystick\r\n  \/\/ Joystick was sitting around 520 for the vertical and horizontal values\r\n  \/\/ Will be 0-1023\r\n  vertical = analogRead(VERT);\r\n  \/\/ Will be 0-1023\r\n  horizontal = analogRead(HORIZ);\r\n  \/\/ Will be HIGH (1) if not pressed, and LOW (0) if pressed\r\n  select = digitalRead(SEL);\r\n  \/\/ Read the value\r\n  \/\/ Power be 0-1023\r\n  iPower = analogRead( iSP1 );\r\n \r\n}\r\n<\/pre>\n<p><strong>setup.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Setup\r\nvoid setup()\r\n{\r\n\r\n  \/\/ EEPROM Unit ID\r\n  isUID();\r\n  \r\n  \/\/ Pause\r\n  delay(5);\r\n  \r\n  \/\/ Make the SEL line an input\r\n  pinMode(SEL, INPUT_PULLUP);\r\n  \r\n  \/\/ Open Serial1 port at 9600 baud\r\n  Serial1.begin( 9600 );\r\n\r\n  \/\/ Pause\r\n  delay(5);\r\n\r\n}\r\n<\/pre>\n<p>&#8212;&#8212;<\/p>\n<p><strong>Fio v3 &#8211; ATmega32U4 &#8211; Receiver<\/strong><\/p>\n<p><strong>XBee S1:<\/strong> Receiver<\/p>\n<p><strong>CH Channel<\/strong>: C<br \/>\n<strong>PAN Id:<\/strong> 3333<br \/>\n<strong>SH Serial Number: 13A200<br \/>\nSL Serial Number:<\/strong> 4076E2C5<br \/>\n<strong>CE Coordinator:<\/strong> End Device<br \/>\n<strong>BD:<\/strong> 9600<\/p>\n<p>RX0 &#8211; Digital 0<br \/>\nTX0 &#8211; Digital 1<br \/>\nDR0 &#8211; Digital 2<br \/>\nST0 &#8211; Digital 3<br \/>\nDR1 &#8211; Digital 4<br \/>\nST1 &#8211; Digital 5<br \/>\nNEO &#8211; Digital 6<br \/>\nVIN &#8211; +3.3V<br \/>\nGND &#8211; GND<\/p>\n<p><strong>DL2112Mk06r.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/* ***** Don Luc Electronics \u00a9 *****\r\nSoftware Version Information\r\nProject #12: Robotics - EasyDriver - Mk16\r\n12-06\r\nDL2112Mk06r.ino\r\n1 x Fio v3 - ATmega32U4\r\n1 x XBee S1\r\n1 x Lithium Ion Battery - 850mAh\r\n1 x RGB Smart NeoPixel\r\n1 x Pololu Adjustable Step-Up Voltage Regulator U1V11A\r\n2 x EasyDriver\r\n2 x Small Stepper\r\n1 x Nine Volt Battery\r\n1 x 9V Battery Connector\r\n1 x Half-Size Breadboard\r\n1 x Full-Size Breadboard\r\n1 x SparkFun Cerberus USB Cable\r\n*\/\r\n\r\n\/\/ Include the library code:\r\n\/\/ EEPROM library to read and write EEPROM with unique ID for unit\r\n#include &lt;EEPROM.h&gt;\r\n\/\/ NeoPixels\r\n#include &lt;Adafruit_NeoPixel.h&gt;\r\n\r\n\/\/ 2 x EasyDriver - 2 x Stepper\r\n\/\/ EasyDriver Right\r\nint dirPinR = 2;\r\n\/\/ stepPin Right\r\nint stepPinR = 3;\r\n\/\/ EasyDriver Left\r\nint dirPinL = 4;\r\n\/\/ stepPin Left\r\nint stepPinL = 5;\r\n\/\/ Microsteps\r\nint i = 0;\r\n\/\/ Power be 0-1023\r\nint iPower = 0;\r\nString POW = &quot;&quot;;\r\n\/\/ Joystick was sitting around 520 for the vertical and horizontal values\r\n\/\/ Will be 0-1023\r\n\/\/ Vertical\r\nint vertical;\r\nString VER = &quot;&quot;;\r\n\/\/ Horizontal\r\n\/\/ Will be 0-1023\r\nint horizontal;\r\nString HOR = &quot;&quot;;\r\n\/\/ Select\r\n\/\/ Will be HIGH (1) if not pressed, and LOW (0) if pressed\r\nint select;\r\nString SEL = &quot;&quot;;\r\nint firstClosingBracket = 0;\r\n\/\/ Map Vertical and Horizontal\r\nint mapVer = 0;\r\nint mapHor = 0;\r\nint iVer = 0;\r\nint iHor = 0;\r\n\r\n\/\/ NeoPixels\r\n\/\/ On digital pin 6\r\n#define PIN 6\r\n\/\/ NeoPixels NUMPIXELS = 1\r\n#define NUMPIXELS 1\r\n\/\/ Pixels\r\nAdafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);\r\n\/\/ Red\r\nint red = 0;\r\n\/\/ Green\r\nint green = 0;\r\n\/\/ Blue\r\nint blue = 0;\r\n\/\/ Neopix\r\nint iNeo = 0;\r\n\/\/ Value\r\nint zz = 0;\r\n\r\n\/\/ Process Message\r\n\/\/ Start\r\nbool bStart = false;\r\n\/\/ End\r\nbool bEnd   = false;\r\n\/\/ Variable to store the incoming byte\r\nint incb = 0;\r\n\/\/ Message\r\nString msg = &quot;&quot;;\r\n\/\/ Index\r\nbyte in = 0;\r\nint x = 0;\r\n\r\n\/\/ Software Version Information\r\nString sver = &quot;12-16r&quot;;\r\n\/\/ Unit ID information\r\nString uid = &quot;&quot;;\r\n\r\nvoid loop() {\r\n\r\n  \/\/ Check for serial messages\r\n  isProcessMessage();\r\n\r\n}\r\n<\/pre>\n<p><strong>getEEPROM.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ EEPROM\r\n\/\/ isUID\r\nvoid isUID()\r\n{\r\n  \r\n  \/\/ Is Unit ID\r\n  uid = &quot;&quot;;\r\n  for (int x = 0; x &lt; 5; x++)\r\n  {\r\n    uid = uid + char(EEPROM.read(x));\r\n  }\r\n  \r\n}\r\n<\/pre>\n<p><strong>getNeopix.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ NeoPixels\r\n\/\/ Neopix\r\nvoid isNeopix() \r\n{ \r\n\r\n    \/\/ Pixels\r\n    pixels.setBrightness( 130 );\r\n    \/\/ Pixels color takes RGB values, from 0,0,0 up to 255,255,255\r\n    pixels.setPixelColor( iNeo, pixels.Color(red,green,blue) ); \r\n    \/\/ This sends the updated pixel color to the hardware\r\n    pixels.show(); \r\n    \/\/ Delay for a period of time (in milliseconds)\r\n    delay(50);     \r\n  \r\n}\r\n\/\/ isNUMPIXELS\r\nvoid isNUMPIXELS()\r\n{\r\n\r\n  \/\/ Neopix Value\r\n  switch ( zz ) {  \r\n    case 0:\r\n      \/\/ NeoPixels Green\r\n      \/\/ Red\r\n      red = 0;\r\n      \/\/ Green\r\n      green = 255;\r\n      \/\/ Blue\r\n      blue = 0;\r\n      \/\/ Neopix\r\n      iNeo = 0;   \r\n      isNeopix();\r\n      break;  \r\n    case 1:\r\n      \/\/ NeoPixels Blue\r\n      \/\/ Red\r\n      red = 0;\r\n      \/\/ Green\r\n      green = 0;\r\n      \/\/ Blue\r\n      blue = 255;\r\n      \/\/ Neopix\r\n      iNeo = 0;\r\n      isNeopix();\r\n      break;\r\n    case 2:\r\n      \/\/ NeoPixels Red\r\n      \/\/ Red\r\n      red = 255;\r\n      \/\/ Green\r\n      green = 0;\r\n      \/\/ Blue\r\n      blue = 0;\r\n      \/\/ Neopix\r\n      iNeo = 0;   \r\n      isNeopix();\r\n      break;\r\n    case 3:\r\n      \/\/ NeoPixels Yellow\r\n      \/\/ Red\r\n      red = 255;\r\n      \/\/ Green\r\n      green = 255;\r\n      \/\/ Blue\r\n      blue = 0;\r\n      \/\/ Neopix\r\n      iNeo = 0;\r\n      isNeopix();\r\n      break;\r\n    case 4:\r\n      \/\/ NeoPixels Magenta\r\n      \/\/ Red\r\n      red = 255;\r\n      \/\/ Green\r\n      green = 0;\r\n      \/\/ Blue\r\n      blue = 255;\r\n      \/\/ Neopix\r\n      iNeo = 0;\r\n      isNeopix();\r\n      break;\r\n    case 5:\r\n      \/\/ NeoPixels Cyan\r\n      \/\/ Red\r\n      red = 0;\r\n      \/\/ Green\r\n      green = 255;\r\n      \/\/ Blue\r\n      blue = 255;\r\n      \/\/ Neopix\r\n      iNeo = 0;\r\n      isNeopix();\r\n      break;\r\n    case 6:\r\n      \/\/ NeoPixels White\r\n      \/\/ Red\r\n      red = 255;\r\n      \/\/ Green\r\n      green = 255;\r\n      \/\/ Blue\r\n      blue = 255;\r\n      \/\/ Neopix\r\n      iNeo = 0;\r\n      isNeopix();    \r\n      break;\r\n  }\r\n  \r\n}\r\n\/\/ isNUMPIXELSoff\r\nvoid isNUMPIXELSoff()\r\n{\r\n\r\n   \/\/ Black Off\r\n   \/\/ NeoPixels\r\n   \/\/ Red\r\n   red = 0;\r\n   \/\/ Green\r\n   green = 0;\r\n   \/\/ Blue\r\n   blue = 0;\r\n   isNeopix();\r\n \r\n}\r\n<\/pre>\n<p><strong>getProcessMessage.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ ProcessMessage\r\n\/\/ isProcessMessage\r\nvoid isProcessMessage() {\r\n\r\n  \/\/ Loop through serial buffer one byte at a time until you reach * which will be end of message\r\n  while ( Serial1.available() &gt; 0 ) \r\n  {\r\n      \r\n      \/\/ Read the incoming byte:\r\n      incb = Serial1.read();\r\n      \r\n      \/\/ Start the message when the &#039;&lt;&#039; symbol is received\r\n      if(incb == &#039;&lt;&#039;)\r\n      {\r\n\r\n        \/\/ Start\r\n        bStart = true;\r\n        in = 0;\r\n        msg = &quot;&quot;;\r\n        \r\n      }\r\n      \/\/ End the message when the &#039;*&#039; symbol is received\r\n      else if(incb == &#039;*&#039;)\r\n      {\r\n        \r\n        \/\/ End\r\n        bEnd = true;\r\n        x = msg.length();\r\n        msg.remove( x , 1);\r\n        \/\/ Done reading\r\n        \r\n        break;\r\n      }\r\n      \/\/ Read the message\r\n      else\r\n      {\r\n        \r\n        \/\/ Message\r\n        msg = msg + char(incb);\r\n        in++;\r\n\r\n      }\r\n      \r\n   }\r\n\r\n   \/\/ Start - End\r\n   if( bStart &amp;&amp; bEnd)\r\n   {\r\n\r\n      \/\/ isStepper =&gt; Message\r\n      isStepper();\r\n      \r\n      \/\/ Start - End\r\n      in = 0;\r\n      msg = &quot;&quot;;\r\n      bStart = false;\r\n      bEnd = false;\r\n      vertical;\r\n      horizontal;\r\n      iPower;\r\n      \r\n   }\r\n\r\n}\r\n<\/pre>\n<p><strong>getStepper.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Stepper\r\n\/\/ isStepperSetup\r\nvoid isStepperSetup() {\r\n\r\n  \/\/ 2 x EasyDriver\r\n  pinMode(dirPinR, OUTPUT);\r\n  pinMode(stepPinR, OUTPUT);\r\n  pinMode(dirPinL, OUTPUT);\r\n  pinMode(stepPinL, OUTPUT);\r\n\r\n}\r\n\/\/ isStepper\r\nvoid isStepper() {\r\n\r\n  \/\/ msg = vertical + &quot;|&quot; + horizontal + &quot;|&quot; + select + &quot;|&quot; + iValue + &quot;|&quot; + sver + &quot;|&quot; + uid\r\n  firstClosingBracket = 0;\r\n  \/\/ Vertical\r\n  firstClosingBracket = msg.indexOf(&#039;|&#039;);\r\n  VER = msg;\r\n  VER.remove(firstClosingBracket);\r\n  vertical = VER.toInt();\r\n  \/\/ Horizontal\r\n  firstClosingBracket = firstClosingBracket + 1;\r\n  msg.remove(0, firstClosingBracket );\r\n  firstClosingBracket = msg.indexOf(&#039;|&#039;);\r\n  HOR = msg;\r\n  HOR.remove(firstClosingBracket);\r\n  horizontal = HOR.toInt();\r\n  \/\/ Select\r\n  firstClosingBracket = firstClosingBracket + 1;\r\n  msg.remove(0, firstClosingBracket );  \r\n  firstClosingBracket = msg.indexOf(&#039;|&#039;);\r\n  SEL = msg;\r\n  SEL.remove(firstClosingBracket);\r\n  select = SEL.toInt();\r\n  \/\/ Power\r\n  firstClosingBracket = firstClosingBracket + 1;\r\n  msg.remove(0, firstClosingBracket );    \r\n  firstClosingBracket = msg.indexOf(&#039;|&#039;);\r\n  POW = msg;\r\n  POW.remove(firstClosingBracket);\r\n  iPower = POW.toInt();\r\n\r\n  \/\/ EasyDriver Right\r\n  \/\/ Set the direction\r\n  \/\/ Joystick was sitting around 520 for the vertical and horizontal values\r\n  \/\/ Will be 0-1023\r\n  mapVer = map(vertical, 0, 1023, -512, 512);\r\n  mapHor = map(horizontal, 0, 1023, -512, 512);\r\n  \r\n  \/\/ Vertical and Horizontal \r\n  if ( mapVer == -512 ) {\r\n\r\n    \/\/ Horizontal \r\n    if ( mapHor == -512 ) {\r\n\r\n      \/\/ Left\r\n      \/\/ NeoPixels Yellow\r\n      zz = 3;\r\n      isNUMPIXELS();\r\n      iVer = 3;\r\n    \r\n    } else if ( mapHor == 512 ) {\r\n\r\n      \/\/ Right\r\n      \/\/ NeoPixels Magenta\r\n      zz = 4;\r\n      isNUMPIXELS();\r\n      iVer = 4;\r\n \r\n    } else {\r\n\r\n      \/\/ Down\r\n      \/\/ NeoPixels Blue\r\n      zz = 1;\r\n      isNUMPIXELS();\r\n      iVer = 1;\r\n    \r\n    }\r\n    \r\n  } else if ( mapVer == 512 ) {\r\n\r\n    \/\/ Horizontal \r\n    if ( mapHor == -512 ) {\r\n\r\n      \/\/ Left\r\n      \/\/ NeoPixels Yellow\r\n      zz = 3;\r\n      isNUMPIXELS();\r\n      iVer = 3;\r\n    \r\n    } else if ( mapHor == 512 ) {\r\n\r\n      \/\/ Right\r\n      \/\/ NeoPixels Magenta\r\n      zz = 4;\r\n      isNUMPIXELS();\r\n      iVer = 4;\r\n \r\n    } else {\r\n\r\n      \/\/ Up\r\n      \/\/ NeoPixels Green\r\n      zz = 0;\r\n      isNUMPIXELS();\r\n      iVer = 4;\r\n      iVer = 2;\r\n    \r\n    }\r\n \r\n  } else if ( mapHor == -512 ) {\r\n\r\n      \/\/ Left\r\n      \/\/ NeoPixels Yellow\r\n      zz = 3;\r\n      isNUMPIXELS();\r\n      iVer = 3;\r\n    \r\n  } else if ( mapHor == 512 ) {\r\n\r\n      \/\/ Right\r\n      \/\/ NeoPixels Magenta\r\n      zz = 4;\r\n      isNUMPIXELS();\r\n      iVer = 4;\r\n \r\n  } else {\r\n\r\n    \/\/ Stop\r\n    \/\/ NeoPixels Red\r\n    zz = 2;\r\n    isNUMPIXELS();\r\n    iVer = 5;\r\n    \r\n  }\r\n\r\n  \/\/ XBee Car\r\n  switch ( iVer ) {\r\n    case 1:\r\n\r\n      \/\/ 2 x EasyDriver - Up\r\n      \/\/ Set the direction LOW\r\n      digitalWrite(dirPinR, LOW);\r\n      delay(5);\r\n      digitalWrite(dirPinL, LOW);\r\n      delay(5);\r\n\r\n      break;\r\n    case 2:\r\n\r\n      \/\/ Stepper 2 - Back\r\n      \/\/ Set the direction HIGH\r\n      digitalWrite(dirPinR, HIGH);\r\n      delay(5);\r\n      digitalWrite(dirPinL, HIGH);\r\n      delay(5);\r\n\r\n      break;\r\n    case 3:\r\n\r\n      \/\/ Stepper 3 - Right\r\n      digitalWrite(dirPinR, LOW);\r\n      delay(5);\r\n      digitalWrite(dirPinL, HIGH);\r\n      delay(5);\r\n\r\n      break;\r\n    case 4:\r\n\r\n      \/\/ Stepper 4 - Left\r\n      digitalWrite(dirPinR, HIGH);\r\n      delay(5);\r\n      digitalWrite(dirPinL, LOW);\r\n      delay(5);\r\n      break;\r\n    case 5:\r\n\r\n      \/\/ Stop\r\n      \/\/ NeoPixels Red\r\n      zz = 2;\r\n      isNUMPIXELS();\r\n      iVer = 5;\r\n      break;\r\n    default:\r\n    \r\n      \/\/ Stop\r\n      \/\/ NeoPixels Red\r\n      zz = 2;\r\n      isNUMPIXELS();\r\n      iVer = 5;\r\n      \r\n  }\r\n\r\n  if ( iVer == 5 ) {\r\n\r\n    \/\/ Stepper Stop\r\n    \/\/ 2 x EasyDriver\r\n    \/\/ Set the direction\r\n    digitalWrite(dirPinR, LOW);\r\n    delay(5);\r\n    \/\/ Set the direction\r\n    digitalWrite(dirPinL, LOW);\r\n    delay(5);\r\n    \/\/ This LOW\r\n    digitalWrite(stepPinR, LOW);\r\n    digitalWrite(stepPinL, LOW);\r\n    \r\n  } else {\r\n\r\n     \/\/ Iterate for 200 microsteps\r\n     for (i = 0; i&lt;200; i++)\r\n     { \r\n\r\n        \/\/ This LOW to HIGH change is what creates the\r\n        digitalWrite(stepPinR, LOW);\r\n        \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n        digitalWrite(stepPinR, HIGH);\r\n        \/\/ This delay time is close to top speed.\r\n        delayMicroseconds(iPower);\r\n        \/\/ This LOW to HIGH change is what creates the\r\n        digitalWrite(stepPinL, LOW);\r\n        \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n        digitalWrite(stepPinL, HIGH);\r\n        \/\/ This delay time is close to top speed.\r\n        delayMicroseconds(iPower);\r\n\r\n     }\r\n    \r\n  }\r\n \r\n}\r\n<\/pre>\n<p><strong>setup.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"arduino\" data-enlighter-title=\"\">\r\n\/\/ Setup\r\nvoid setup() {\r\n\r\n  \/\/ Open the serial port at 9600 bps:\r\n  Serial1.begin( 9600 );\r\n\r\n  \/\/ Pause\r\n  delay(5);\r\n\r\n  \/\/ EEPROM Unit ID\r\n  isUID();\r\n  \r\n  \/\/ Pause\r\n  delay(5);\r\n\r\n  \/\/ 2 x EasyDriver\r\n  isStepperSetup();\r\n\r\n  \/\/ Pause\r\n  delay(5);\r\n  \r\n  \/\/ NeoPixels\r\n  \/\/ This initializes the NeoPixel library\r\n  pixels.begin();\r\n  \/\/ Delay for a period of time (in milliseconds)\r\n  delay(50);\r\n  \/\/ isNUMPIXELS Off\r\n  isNUMPIXELSoff();\r\n\r\n}\r\n<\/pre>\n<p>&#8212;&#8212;<\/p>\n<p><strong>People can contact us:<\/strong> https:\/\/www.donluc.com\/?page_id=1927<\/p>\n<p><strong>Technology Experience<\/strong><\/p>\n<ul>\n<li>Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc&#8230;)<\/li>\n<li>IoT<\/li>\n<li>Robotics<\/li>\n<li>Camera and Video Capture Receiver Stationary, Wheel\/Tank and Underwater Vehicle<\/li>\n<li>Unmanned Vehicles Terrestrial and Marine<\/li>\n<li>Research &#038; Development (R &#038; D)<\/li>\n<li>Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc&#8230;)<\/li>\n<li>Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc&#8230;)<\/li>\n<li>Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc&#8230;)<\/li>\n<li>Social Media Programming &#038; Integration (Facebook, Twitter, YouTube, Pinterest, etc&#8230;)<\/li>\n<li>Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc&#8230;)<\/li>\n<li>Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc&#8230;)<\/li>\n<li>eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc&#8230;)<\/li>\n<\/ul>\n<p><strong>Instructor and E-Mentor<\/strong><\/p>\n<ul>\n<li>IoT<\/li>\n<li>PIC Microcontrollers<\/li>\n<li>Arduino<\/li>\n<li>Raspberry Pi<\/li>\n<li>Espressif<\/li>\n<li>Robotics<\/li>\n<li>DOS, Windows, OSX, Linux, iOS, Android, Multi-OS<\/li>\n<li>Linux-Apache-PHP-MySQL<\/li>\n<\/ul>\n<p><strong>Follow Us<\/strong><\/p>\n<p><strong>J. Luc Paquin \u2013 Curriculum Vitae &#8211; 2021 English &#038; Espa\u00f1ol<\/strong><br \/>\nhttps:\/\/www.jlpconsultants.com\/luc\/<\/p>\n<p><strong>Web:<\/strong> https:\/\/www.donluc.com\/<br \/>\n<strong>Web:<\/strong> https:\/\/www.jlpconsultants.com\/<br \/>\n<strong>Facebook:<\/strong> https:\/\/www.facebook.com\/neosteam.labs.9\/<br \/>\n<strong>YouTube:<\/strong> https:\/\/www.youtube.com\/channel\/UC5eRjrGn1CqkkGfZy0jxEdA<br \/>\n<strong>Twitter:<\/strong> https:\/\/twitter.com\/labs_steam<br \/>\n<strong>Pinterest:<\/strong> https:\/\/www.pinterest.com\/NeoSteamLabs\/<br \/>\n<strong>Instagram:<\/strong> https:\/\/www.instagram.com\/neosteamlabs\/<\/p>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8212;&#8212; #DonLucElectronics #DonLuc #Robotics #Arduino #Fio #XBee #Stepper #EasyDriver #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; Stepper Motor A stepper motor, also known as step motor or stepping motor, is a brushless DC electric motor that divides a full rotation into a number of equal steps. The motor&#8217;s position can be commanded &#8230; <a title=\"Project #12: Robotics &#8211; EasyDriver &#8211; Mk16\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=2950\" aria-label=\"Read more about Project #12: Robotics &#8211; EasyDriver &#8211; Mk16\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[94,47,50,49,38,59,5,46,58,10,43],"tags":[86,6,92,102,4,198,19,24,103,27,95,109,96,33,100],"class_list":["post-2950","post","type-post","status-publish","format-standard","hentry","category-robotics-projerts","category-adafruit","category-arduino","category-consultant","category-digitalelectronics","category-fritzing","category-microcontrollers","category-pololu","category-arduino-programming","category-projects","category-sparkfun","tag-adafruit","tag-arduino","tag-battery","tag-components","tag-consultant","tag-easydriver","tag-electronics","tag-microcontroller","tag-pololu","tag-projects-2","tag-robotic","tag-sparkfun","tag-stepper","tag-technology","tag-xbee"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/2950","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2950"}],"version-history":[{"count":1,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/2950\/revisions"}],"predecessor-version":[{"id":2955,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/2950\/revisions\/2955"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2950"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}