{"id":2078,"date":"2020-02-05T13:05:56","date_gmt":"2020-02-05T21:05:56","guid":{"rendered":"http:\/\/www.donluc.com\/?p=2078"},"modified":"2020-02-05T13:05:56","modified_gmt":"2020-02-05T21:05:56","slug":"project-12-robotics-unmanned-vehicles-1c-mk07","status":"publish","type":"post","link":"https:\/\/www.donluc.com\/?p=2078","title":{"rendered":"Project #12: Robotics &#8211; Unmanned Vehicles 1c &#8211; Mk07"},"content":{"rendered":"<div style=\"width: 720px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-2078-1\" width=\"720\" height=\"406\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2020\/02\/dl2002mk01.mp4?_=1\" \/><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2020\/02\/dl2002mk01.mp4\">https:\/\/www.donluc.com\/wp-content\/uploads\/2020\/02\/dl2002mk01.mp4<\/a><\/video><\/div>\n<p>&#8212;&#8212;<\/p>\n<p><a href=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2020\/02\/DL2002Mk01a.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2020\/02\/DL2002Mk01a.png\" alt=\"Robotics\" width=\"720\" height=\"483\" class=\"alignnone size-full wp-image-2080\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2020\/02\/DL2002Mk01a.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2020\/02\/DL2002Mk01a-300x201.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\/2020\/02\/DL2002Mk01b.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2020\/02\/DL2002Mk01b.png\" alt=\"Robotics\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-2081\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2020\/02\/DL2002Mk01b.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2020\/02\/DL2002Mk01b-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\/2020\/02\/DL2002Mk01c.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2020\/02\/DL2002Mk01c.png\" alt=\"Robotics\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-2082\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2020\/02\/DL2002Mk01c.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2020\/02\/DL2002Mk01c-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\/2020\/02\/DL2002Mk01d.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2020\/02\/DL2002Mk01d.png\" alt=\"Robotics\" width=\"720\" height=\"480\" class=\"alignnone size-full wp-image-2083\" srcset=\"https:\/\/www.donluc.com\/wp-content\/uploads\/2020\/02\/DL2002Mk01d.png 720w, https:\/\/www.donluc.com\/wp-content\/uploads\/2020\/02\/DL2002Mk01d-300x200.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/a><\/p>\n<p>&#8212;&#8212;<\/p>\n<p><strong>DL2002Mk01<\/strong><\/p>\n<p>1 x Arduino UNO &#8211; R3<br \/>\n1 x Arduino UNO &#8211; SparkFun RedBoard<br \/>\n1 x ProtoScrewShield<br \/>\n1 x Adafruit RGB LCD Shield 16\u00d72 Character Display<br \/>\n2 x XBee S1<br \/>\n1 x SparkFun XBee Explorer Regulated<br \/>\n1 x Breakout Board for XBee Module<br \/>\n2 x EasyDriver<br \/>\n2 x Small Stepper<br \/>\n6 x Jumper Wires 3&#8243; M\/M<br \/>\n12 x Jumper Wires 6&#8243; M\/M<br \/>\n1 x Full-Size Breadboard<br \/>\n1 x SparkFun XBee Explorer USB<br \/>\n1 x DIGI XCTU Software<br \/>\n1 x SparkFun USB Mini-B Cable<br \/>\n1 x SparkFun Cerberus USB Cable<\/p>\n<p><strong>Arduino UNO<\/strong><\/p>\n<p>TX0 &#8211; Digital 1<br \/>\nRX0 &#8211; Digital 0<br \/>\nVIN &#8211; +5V<br \/>\nGND &#8211; GND<\/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><strong>DL2002Mk01p.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"DL2002Mk01p.ino\">\r\n\/\/ ***** Don Luc Electronics \u00a9 *****\r\n\/\/ Software Version Information\r\n\/\/ Project #12: Robotics - Unmanned Vehicles 1c - Mk07\r\n\/\/ 02-01\r\n\/\/ DL2002Mk01p.ino 12-07\r\n\/\/ Arduino UNO - R3\r\n\/\/ ProtoScrewShield\r\n\/\/ Adafruit RGB LCD Shield 16\u00d72 Character Display\r\n\/\/ EEPROM with Unique ID\r\n\/\/ Transmitter\r\n\/\/ XBee S1\r\n\/\/ Stepper\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\/\/ Adafruit RGB LCD Shield\r\n#include &lt;Adafruit_RGBLCDShield.h&gt;\r\n\r\n\/\/ Adafruit RGB LCD Shield\r\nAdafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield();\r\n\r\n\/\/ These #defines make it easy to set the backlight color\r\n#define OFF 0x0\r\n#define RED 0x1\r\n#define YELLOW 0x3\r\n#define GREEN 0x2\r\n#define TEAL 0x6\r\n#define BLUE 0x4\r\n#define VIOLET 0x5\r\n#define WHITE 0x7\r\n\r\n\/\/ Momentary Button\r\nint yy = 0;\r\nuint8_t momentaryButton = 0;\r\n\r\n\/\/ Communication\r\nunsigned long dTime = 50;\r\n\r\n\/\/ The current address in the EEPROM (i.e. which byte we&#039;re going to  read to next)\r\n\/\/ Version\r\nString sver = &quot;12-7.p&quot;;\r\n\/\/ Unit ID Information\r\nString uid = &quot;&quot;;\r\n\r\nvoid loop() {\r\n\r\n  \/\/ Clear\r\n  RGBLCDShield.clear();\r\n\r\n  \/\/ set the cursor to column 0, line 0\r\n  RGBLCDShield.setCursor(0,0);\r\n  RGBLCDShield.print(&quot;Robotics&quot;);         \/\/ Robotics \r\n\r\n  \/\/ Momentary Button\r\n  momentaryButton = RGBLCDShield.readButtons();\r\n\r\n  switch ( yy ) {\r\n    case 1:\r\n    \r\n      \/\/ Up\r\n      isSwitch1();\r\n      \r\n      break;\r\n    case 2:\r\n    \r\n      \/\/ Down\r\n      isSwitch2();\r\n      \r\n      break;\r\n    case 3:\r\n\r\n      \/\/ Right\r\n      isSwitch3();\r\n      \r\n      break;\r\n    case 4:\r\n\r\n      \/\/ Left\r\n      isSwitch4();\r\n      \r\n      break;\r\n    case 5:\r\n\r\n      \/\/ Stop\r\n      isSwitch5();\r\n      \r\n      break;\r\n    default:\r\n\r\n      \/\/ Stop\r\n      yy = 5;\r\n      RGBLCDShield.setBacklight(RED);\r\n      isSwitch5();\r\n\r\n   }\r\n   \r\n   if ( momentaryButton ) {\r\n    \r\n    if ( momentaryButton &amp; BUTTON_UP ) {\r\n      \r\n      yy = 1;\r\n      \/\/ Up\r\n      RGBLCDShield.setBacklight(GREEN);\r\n      \r\n    }\r\n    \r\n    if ( momentaryButton &amp; BUTTON_DOWN ) {\r\n      \r\n      yy = 2;\r\n      \/\/ Down\r\n      RGBLCDShield.setBacklight(VIOLET);\r\n      \r\n    }\r\n    \r\n    if ( momentaryButton &amp; BUTTON_LEFT ) {\r\n      \r\n      yy = 3;\r\n      \/\/ Right\r\n      RGBLCDShield.setBacklight(TEAL);\r\n      \r\n    }\r\n    \r\n    if ( momentaryButton &amp; BUTTON_RIGHT ) {\r\n\r\n      yy = 4;\r\n      \/\/ Left\r\n      RGBLCDShield.setBacklight(YELLOW);\r\n    }\r\n    \r\n    if ( momentaryButton &amp; BUTTON_SELECT ) {\r\n\r\n      yy = 5;\r\n      \/\/ Stop\r\n      RGBLCDShield.setBacklight(RED);\r\n   \r\n    }\r\n    \r\n  }\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=\"default\" data-enlighter-title=\"getEEPROM.ino\">\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>getProcessMessage.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"getProcessMessage.ino\">\r\n\/\/ ProcessMessage\r\n\/\/ isProcessMessage\r\nvoid isProcessMessage() {\r\n\r\n   \/\/ String msg = &quot;&quot;;\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 ( Serial.available() ) \r\n  \/\/ {\r\n\r\n      \/\/ Print =&gt; XBEE + Unit ID + Version + *\r\n      \/\/ msg = &quot;XBEE|&quot; + uid + &quot;|&quot; + sver + &quot;|&quot; + yy + &quot;|*&quot;;\r\n      \r\n      Serial.print( &#039;&lt;&#039;  );\r\n      Serial.print( yy );\r\n      Serial.println( &#039;*&#039; );\r\n         \r\n  \/\/ }\r\n     \r\n}\r\n<\/pre>\n<p><strong>getSwitch.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"getSwitch.ino\">\r\n\/\/ Switch\r\n\/\/ Switch 1\r\nvoid isSwitch1(){\r\n\r\n   yy = 1;\r\n\r\n   \/\/ Stepper \r\n   \/\/ Up\r\n   RGBLCDShield.setCursor(0,1);    \r\n   RGBLCDShield.print(&quot;Up&quot;);  \r\n   \r\n}\r\n\/\/ Switch 2\r\nvoid isSwitch2(){\r\n\r\n   yy = 2;\r\n\r\n   \/\/ Stepper \r\n   \/\/ Down\r\n   RGBLCDShield.setCursor(0,1);    \r\n   RGBLCDShield.print(&quot;Down&quot;);    \r\n      \r\n}\r\n\/\/ Switch 3\r\nvoid isSwitch3(){\r\n\r\n   yy = 3;\r\n\r\n   \/\/ Stepper \r\n   \/\/ Right\r\n   RGBLCDShield.setCursor(0,1);    \r\n   RGBLCDShield.print(&quot;Right&quot;);    \r\n      \r\n}\r\n\/\/ Switch 4\r\nvoid isSwitch4(){\r\n\r\n   yy = 4;\r\n\r\n   \/\/ Stepper \r\n   \/\/ Left\r\n   RGBLCDShield.setCursor(0,1);    \r\n   RGBLCDShield.print(&quot;Left&quot;); \r\n      \r\n}\r\n\/\/ Switch 5\r\nvoid isSwitch5(){\r\n\r\n   yy = 5;\r\n   \r\n   \/\/ Stepper \r\n   \/\/ Stop\r\n   RGBLCDShield.setCursor(0,1);    \r\n   RGBLCDShield.print(&quot;Stop&quot;);\r\n       \r\n}\r\n<\/pre>\n<p><strong>setup.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"setup.ino\">\r\n\/\/ Setup\r\nvoid setup() {\r\n  \r\n  \/\/ Open serial port at 9600 baud\r\n  Serial.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  \/\/ Adafruit RGB LCD Shield\r\n  \/\/ Set up the LCD&#039;s number of columns and rows: \r\n  RGBLCDShield.begin(16, 2);\r\n  RGBLCDShield.setBacklight(GREEN);\r\n  \r\n  \/\/ Display\r\n  \/\/ Set the cursor to column 0, line 0  \r\n  RGBLCDShield.setCursor(0,0);  \r\n  RGBLCDShield.print(&quot;Don Luc Electron&quot;);         \/\/ Don luc Electron\r\n  \/\/ Set the cursor to column 0, line 1\r\n  RGBLCDShield.setCursor(0, 1);\r\n  RGBLCDShield.print(&quot;Robotics&quot;);                 \/\/ Robotics\r\n\r\n  \/\/ Serial\r\n  \/\/ Serial.println( &quot;Don Luc Electronics&quot;);\r\n  \/\/ Serial.println( &quot;Robotics&quot;);\r\n\r\n  delay(5000);\r\n\r\n  \/\/ Clear\r\n  RGBLCDShield.clear();\r\n\r\n  \/\/ Display\r\n  \/\/ Set the cursor to column 0, line 0  \r\n  RGBLCDShield.setCursor(0,0);  \r\n  RGBLCDShield.print(&quot;Version: &quot;);                \/\/ Version\r\n  RGBLCDShield.print( sver );\r\n  \/\/ Set the cursor to column 0, line 1\r\n  RGBLCDShield.setCursor(0, 1);\r\n  RGBLCDShield.print(&quot;UID: &quot;);                    \/\/ Unit ID Information\r\n  RGBLCDShield.print( uid );\r\n\r\n  \/\/ Serial\r\n  \/\/ Serial.print( &quot;Software Version Information: &quot;);\r\n  \/\/ Serial.println( sver );\r\n  \/\/ Serial.print( &quot;Unit ID Information: &quot;);\r\n  \/\/ Serial.println( uid );\r\n\r\n  delay(5000);\r\n\r\n  \/\/ Clear\r\n  RGBLCDShield.clear();\r\n\r\n}\r\n<\/pre>\n<p><strong>Arduino UNO &#8211; SparkFun RedBoard<\/strong><\/p>\n<p>SP1 &#8211; Digital 3<br \/>\nDI1 &#8211; Digital 2<br \/>\nSP2 &#8211; Digital 5<br \/>\nDI2 &#8211; Digital 4<br \/>\nTX0 &#8211; Digital 1<br \/>\nRX0 &#8211; Digital 0<br \/>\nVIN &#8211; +3.3V<br \/>\nGND &#8211; GND<\/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:<\/strong> 13A200<br \/>\n<strong>SL Serial Number:<\/strong> 4076E2C5<br \/>\n<strong>CE Coordinator:<\/strong> End Device<br \/>\n<strong>BD:<\/strong> 9600<\/p>\n<p><strong>DL2002Mk01Rp.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"DL2002Mk01Rp.ino\">\r\n\/\/ ***** Don Luc Electronics \u00a9 *****\r\n\/\/ Software Version Information\r\n\/\/ Project #12: Robotics - Unmanned Vehicles 1c - Mk07\r\n\/\/ 02-01\r\n\/\/ DL2002Mk01Rp.ino 12-07\r\n\/\/ Arduino UNO - SparkFun RedBoard\r\n\/\/ EEPROM with Unique ID\r\n\/\/ Receiver\r\n\/\/ Breakout Board for XBee Module\r\n\/\/ XBee S1\r\n\/\/ 2 x EasyDriver\r\n\/\/ 2 x Small Stepper\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\/\/ Momentary Button\r\nint yy = &quot;&quot;;\r\n\r\n\/\/ 2 x EasyDriver - 2 x Stepper\r\nint dirPinR = 2;                           \/\/ EasyDriver Right\r\nint stepPinR = 3;                          \/\/ stepPin Right\r\nint dirPinL = 4;                           \/\/ EasyDriver Left\r\nint stepPinL = 5;                          \/\/ stepPin Left\r\nint i = 0;\r\n\r\n\/\/ Software Version Information\r\nString sver = &quot;12-07&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  if ( Serial.available() ) \r\n  {\r\n    \r\n    isProcessMessage();\r\n    \r\n  }\r\n\r\n  \/\/ Switch\r\n  isSwitch();\r\n  \r\n}\r\n<\/pre>\n<p><strong>getEEPROM.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"getEEPROM.ino\">\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>getProcessMessage.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"getProcessMessage.ino\">\r\n\/\/ ProcessMessage\r\n\/\/ isProcessMessage\r\nvoid isProcessMessage() {\r\n\r\n   int incb = 0;  \r\n   String msg = &quot;&quot;;\r\n   String zzz = &quot;&quot;;\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 ( Serial.available() ) \r\n  {\r\n      \r\n      \/\/ Read the incoming byte:\r\n      incb = Serial.read();\r\n      \/\/ Add character to string\r\n      msg = msg + char(incb);\r\n      \r\n      \/\/ Check if receive character is the end of message *\r\n      if ( incb == 42 ) \r\n      {\r\n         \r\n         \/\/ Serial.println(msg);\r\n\r\n         zzz = msg.charAt( 1 );\r\n         \r\n         \/\/ Serial.println(zzz);\r\n         \r\n         yy = zzz.toInt();\r\n         \r\n         \/\/ Serial.println( yy );\r\n        \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=\"default\" data-enlighter-title=\"getStepper.ino\">\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\/\/ isStepper1\r\nvoid isStepper1(){\r\n\r\n   \/\/ 2 x EasyDriver - Up\r\n   digitalWrite(dirPinR, LOW);              \/\/ Set the direction.\r\n   delay(5);\r\n   digitalWrite(dirPinL, LOW);              \/\/ Set the direction.\r\n   delay(5);\r\n\r\n   for (i = 0; i&lt;300; i++)                 \/\/ Iterate for 1000 microsteps.\r\n   { \r\n     digitalWrite(stepPinR, LOW);           \/\/ This LOW to HIGH change is what creates the\r\n     digitalWrite(stepPinR, HIGH);          \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n     delayMicroseconds(300);                \/\/ This delay time is close to top speed.\r\n     digitalWrite(stepPinL, LOW);           \/\/ This LOW to HIGH change is what creates the\r\n     digitalWrite(stepPinL, HIGH);          \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n     delayMicroseconds(300);                \/\/ This delay time is close to top speed.\r\n   } \r\n   \r\n}\r\n\/\/ isStepper2\r\nvoid isStepper2(){\r\n\r\n   \/\/ 2 x EasyDriver\r\n   digitalWrite(dirPinR, HIGH);              \/\/ Set the direction.\r\n   delay(5);\r\n   digitalWrite(dirPinL, HIGH);              \/\/ Set the direction.\r\n   delay(5);\r\n\r\n   for (i = 0; i&lt;1000; i++)                 \/\/ Iterate for 1000 microsteps.\r\n   { \r\n     digitalWrite(stepPinR, LOW);           \/\/ This LOW to HIGH change is what creates the\r\n     digitalWrite(stepPinR, HIGH);          \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n     delayMicroseconds(300);                \/\/ This delay time is close to top speed.\r\n     digitalWrite(stepPinL, LOW);           \/\/ This LOW to HIGH change is what creates the\r\n     digitalWrite(stepPinL, HIGH);          \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n     delayMicroseconds(300);                \/\/ This delay time is close to top speed.\r\n   } \r\n   \r\n}\r\n\/\/ Switch 3\r\nvoid isStepper3(){\r\n\r\n   \/\/ Right\r\n\r\n   \/\/ 2 x EasyDriver\r\n   digitalWrite(dirPinR, LOW);               \/\/ Set the direction.\r\n   delay(5);\r\n   digitalWrite(dirPinL, HIGH);              \/\/ Set the direction.\r\n   delay(5);\r\n\r\n   for (i = 0; i&lt;300; i++)                 \/\/ Iterate for 1000 microsteps.\r\n   {\r\n     digitalWrite(stepPinR, LOW);           \/\/ This LOW to HIGH change is what creates the\r\n     digitalWrite(stepPinR, HIGH);          \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n     delayMicroseconds(300);                \/\/ This delay time is close to top speed.\r\n     digitalWrite(stepPinL, LOW);           \/\/ This LOW to HIGH change is what creates the\r\n     digitalWrite(stepPinL, HIGH);          \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n     delayMicroseconds(300);                \/\/ This delay time is close to top speed.\r\n   }    \r\n  \r\n}\r\n\/\/ Switch 4\r\nvoid isStepper4(){\r\n\r\n   \/\/ Left\r\n   \/\/ 2 x EasyDriver\r\n   digitalWrite(dirPinR, HIGH);             \/\/ Set the direction.\r\n   delay(5);\r\n   digitalWrite(dirPinL, LOW);              \/\/ Set the direction.\r\n   delay(5);\r\n\r\n   for (i = 0; i&lt;300; i++)                 \/\/ Iterate for 1000 microsteps.\r\n   {\r\n     digitalWrite(stepPinR, LOW);           \/\/ This LOW to HIGH change is what creates the\r\n     digitalWrite(stepPinR, HIGH);          \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n     delayMicroseconds(300);                \/\/ This delay time is close to top speed.\r\n     digitalWrite(stepPinL, LOW);           \/\/ This LOW to HIGH change is what creates the\r\n     digitalWrite(stepPinL, HIGH);          \/\/ &quot;Rising Edge&quot; so the easydriver knows to when to step.\r\n     delayMicroseconds(300);                \/\/ This delay time is close to top speed.\r\n   }    \r\n    \r\n}\r\n\/\/ isStepperStop\r\nvoid isStepperStop() {\r\n\r\n   \/\/ 2 x EasyDriver\r\n   digitalWrite(dirPinR, LOW);              \/\/ Set the direction.\r\n   delay(5);\r\n   digitalWrite(dirPinL, LOW);              \/\/ Set the direction.\r\n   delay(5);\r\n   digitalWrite(stepPinR, LOW);             \/\/ This LOW to HIGH change is what creates the\r\n   digitalWrite(stepPinL, LOW);             \/\/ This LOW to HIGH change is what creates the \r\n\r\n}\r\n<\/pre>\n<p><strong>getSwitch.ino<\/strong><\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"default\" data-enlighter-title=\"getSwitch.ino\">\r\n\/\/ Switch\r\n\/\/ isSwitch\r\nvoid isSwitch(){\r\n  \r\n  switch ( yy ) {\r\n    case 1:\r\n\r\n      \/\/ Stepper 1 - Up\r\n      isStepper1();\r\n\r\n      break;\r\n    case 2:\r\n      \r\n      \/\/ Stepper 2 - Back\r\n      isStepper2();\r\n      \r\n      break;\r\n    case 3:\r\n\r\n      \/\/ Stepper 3 - Right\r\n      isStepper3();\r\n      \r\n      break;\r\n    case 4:\r\n      \r\n      \/\/ Stepper 4 - Left\r\n      isStepper4();\r\n      \r\n      break;\r\n    case 5:\r\n      \r\n      \/\/ Stepper Stop\r\n      isStepperStop();\r\n       \r\n      break;\r\n    default:\r\n\r\n      \/\/ Stepper Stop\r\n      isStepperStop();\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=\"default\" data-enlighter-title=\"setup.ino\">\r\n\/\/ Setup\r\nvoid setup() {\r\n\r\n  \/\/ Open the serial port at 9600 bps:\r\n  Serial.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  \/\/ Serial\r\n  \/\/ Serial.print( &quot;Software Version Information: &quot;);\r\n  \/\/ Serial.println( sver );\r\n  \/\/ Serial.print( &quot;Unit ID Information: &quot;);\r\n  \/\/ Serial.println( uid );\r\n  \r\n  \/\/ delay(5000);\r\n\r\n  \/\/ 2 x EasyDriver\r\n  isStepperSetup();\r\n\r\n}\r\n<\/pre>\n<p><strong>Follow Us<\/strong><\/p>\n<p><strong>J. Luc Paquin \u2013 Curriculum Vitae<\/strong><br \/>\nhttps:\/\/www.donluc.com\/DLHackster\/LucPaquinCVEngMk2020a.pdf<\/p>\n<p><strong>Web:<\/strong> https:\/\/www.donluc.com\/<br \/>\n<strong>Web:<\/strong> http:\/\/www.jlpconsultants.com\/<br \/>\n<strong>Web:<\/strong> https:\/\/www.donluc.com\/DLHackster\/<br \/>\n<strong>Web:<\/strong> https:\/\/www.hackster.io\/neosteam-labs<br \/>\n<strong>Web:<\/strong> http:\/\/neosteamlabs.com\/<br \/>\n<strong>YouTube:<\/strong> https:\/\/www.youtube.com\/channel\/UC5eRjrGn1CqkkGfZy0jxEdA<br \/>\n<strong>Facebook:<\/strong> https:\/\/www.facebook.com\/neosteam.labs.9\/<br \/>\n<strong>Instagram:<\/strong> https:\/\/www.instagram.com\/neosteamlabs\/<br \/>\n<strong>Pinterest:<\/strong> https:\/\/www.pinterest.com\/NeoSteamLabs\/<br \/>\n<strong>Twitter:<\/strong> https:\/\/twitter.com\/labs_steam<br \/>\n<strong>Etsy:<\/strong> https:\/\/www.etsy.com\/shop\/NeoSteamLabs<\/p>\n<p><strong>Don Luc<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; &#8212;&#8212; DL2002Mk01 1 x Arduino UNO &#8211; R3 1 x Arduino UNO &#8211; SparkFun RedBoard 1 x ProtoScrewShield 1 x Adafruit RGB LCD Shield 16\u00d72 Character Display 2 x XBee S1 1 x SparkFun XBee Explorer Regulated 1 x Breakout Board for XBee Module 2 x EasyDriver 2 x Small Stepper &#8230; <a title=\"Project #12: Robotics &#8211; Unmanned Vehicles 1c &#8211; Mk07\" class=\"read-more\" href=\"https:\/\/www.donluc.com\/?p=2078\" aria-label=\"Read more about Project #12: Robotics &#8211; Unmanned Vehicles 1c &#8211; Mk07\">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,38,59,5,58,10,43],"tags":[86,6,87,19,85,24,9,27,95,96,34,100],"class_list":["post-2078","post","type-post","status-publish","format-standard","hentry","category-robotics-projerts","category-adafruit","category-arduino","category-digitalelectronics","category-fritzing","category-microcontrollers","category-arduino-programming","category-projects","category-sparkfun","tag-adafruit","tag-arduino","tag-display","tag-electronics","tag-fritzing","tag-microcontroller","tag-programming","tag-projects-2","tag-robotic","tag-stepper","tag-video-blog","tag-xbee"],"_links":{"self":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/2078","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=2078"}],"version-history":[{"count":2,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/2078\/revisions"}],"predecessor-version":[{"id":4178,"href":"https:\/\/www.donluc.com\/index.php?rest_route=\/wp\/v2\/posts\/2078\/revisions\/4178"}],"wp:attachment":[{"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2078"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2078"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.donluc.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2078"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}