SparkFun
SparkFun
Project #12: Robotics – Unmanned Vehicles 1e – Mk09
——
——
——
——
——
——
DL2002Mk05
1 x Arduino UNO – R3
1 x Arduino UNO – SparkFun RedBoard
1 x ProtoScrewShield
1 x Adafruit RGB LCD Shield 16×2 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
1 x Adafruit PowerBoost 500 Shield
1 x Lithium Ion Battery – 2Ah
1 x LED Green
1 x Slide Pot (Small)
1 x Knob
7 x Jumper Wires 3″ M/M
16 x Jumper Wires 6″ M/M
1 x Full-Size Breadboard
1 x SparkFun XBee Explorer USB
1 x DIGI XCTU Software
1 x SparkFun USB Mini-B Cable
1 x SparkFun Cerberus USB Cable
Arduino UNO
TX0 – Digital 1
RX0 – Digital 0
LP1 – Analog A0
VIN – +5V
GND – GND
XBee S1: Transmitter
CH Channel: C
PAN Id: 3333
SH Serial Number: 13A200
SL Serial Number: 40717A1F
CE Coordinator: Coordinator
BD: 9600
DL2002Mk05p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #12: Robotics - Unmanned Vehicles 1d - Mk09 // 02-05 // DL2002Mk01p.ino 12-09 // Arduino UNO - R3 // ProtoScrewShield // Adafruit RGB LCD Shield 16×2 Character Display // EEPROM with Unique ID // Transmitter // XBee S1 // Stepper // Slide Pot (Small) // Knob // Include the library code: // EEPROM library to read and write EEPROM with unique ID for unit #include <EEPROM.h> // Adafruit RGB LCD Shield #include <Adafruit_RGBLCDShield.h> // Adafruit RGB LCD Shield Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield(); // These #defines make it easy to set the backlight color #define OFF 0x0 #define RED 0x1 #define YELLOW 0x3 #define GREEN 0x2 #define TEAL 0x6 #define BLUE 0x4 #define VIOLET 0x5 #define WHITE 0x7 // Momentary Button int yy = 0; uint8_t momentaryButton = 0; // Communication unsigned long dTime = 50; // Slide Pot (Small) int iSP1 = A0; // Select the input pin for the slide pot int iValue = 0; // Variable to store the value // The current address in the EEPROM (i.e. which byte we're going to read to next) // Version String sver = "12-9.p"; // Unit ID Information String uid = ""; void loop() { // Clear RGBLCDShield.clear(); // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Robotics"); // Robotics // Momentary Button momentaryButton = RGBLCDShield.readButtons(); switch ( yy ) { case 1: // Up isSwitch1(); break; case 2: // Down isSwitch2(); break; case 3: // Right isSwitch3(); break; case 4: // Left isSwitch4(); break; case 5: // Stop isSwitch5(); break; default: // Stop yy = 5; RGBLCDShield.setBacklight(RED); isSwitch5(); } if ( momentaryButton ) { if ( momentaryButton & BUTTON_UP ) { yy = 1; // Up RGBLCDShield.setBacklight(GREEN); } if ( momentaryButton & BUTTON_DOWN ) { yy = 2; // Down RGBLCDShield.setBacklight(VIOLET); } if ( momentaryButton & BUTTON_LEFT ) { yy = 3; // Right RGBLCDShield.setBacklight(TEAL); } if ( momentaryButton & BUTTON_RIGHT ) { yy = 4; // Left RGBLCDShield.setBacklight(YELLOW); } if ( momentaryButton & BUTTON_SELECT ) { yy = 5; // Stop RGBLCDShield.setBacklight(RED); } } // Read the value iValue = analogRead( iSP1 ); // Process Message isProcessMessage(); delay( dTime ); }
getEEPROM.ino
// EEPROM // isUID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getProcessMessage.ino
// ProcessMessage // isProcessMessage void isProcessMessage() { // String msg = ""; /// Loop through serial buffer one byte at a time until you reach * which will be end of message //while ( Serial.available() ) // { // Print => XBEE + Unit ID + Version + * // msg = "XBEE|" + uid + "|" + sver + "|" + yy + "|*"; Serial.print( '<' ); Serial.print( yy ); Serial.print( '|' ); Serial.print( iValue ); Serial.println( '*' ); // } }
getSwitch.ino
// Switch // Switch 1 void isSwitch1(){ yy = 1; // Stepper // Up RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Up"); } // Switch 2 void isSwitch2(){ yy = 2; // Stepper // Down RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Down"); } // Switch 3 void isSwitch3(){ yy = 3; // Stepper // Right RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Right"); } // Switch 4 void isSwitch4(){ yy = 4; // Stepper // Left RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Left"); } // Switch 5 void isSwitch5(){ yy = 5; // Stepper // Stop RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Stop"); }
setup.ino
// Setup void setup() { // Open serial port at 9600 baud Serial.begin( 9600 ); // Pause delay(5); // EEPROM Unit ID isUID(); // Pause delay(5); // Adafruit RGB LCD Shield // Set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); RGBLCDShield.setBacklight(GREEN); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc Electron"); // Don luc Electron // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("Robotics"); // Robotics // Serial // Serial.println( "Don Luc Electronics"); // Serial.println( "Robotics"); delay(5000); // Clear RGBLCDShield.clear(); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Version: "); // Version RGBLCDShield.print( sver ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("UID: "); // Unit ID Information RGBLCDShield.print( uid ); // Serial // Serial.print( "Software Version Information: "); // Serial.println( sver ); // Serial.print( "Unit ID Information: "); // Serial.println( uid ); delay(5000); // Clear RGBLCDShield.clear(); }
Arduino UNO – SparkFun RedBoard
LEG – Digital 6
SP1 – Digital 3
DI1 – Digital 2
SP2 – Digital 5
DI2 – Digital 4
TX0 – Digital 1
RX0 – Digital 0
VIN – +5V
GND – GND
XBee S1: Receiver
CH Channel: C
PAN Id: 3333
SH Serial Number: 13A200
SL Serial Number: 4076E2C5
CE Coordinator: End Device
BD: 9600
DL2002Mk05Rp.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #12: Robotics - Unmanned Vehicles 1e - Mk09 // 02-05 // DL2002Mk05Rp.ino 12-09 // Arduino UNO - SparkFun RedBoard // EEPROM with Unique ID // Receiver // Breakout Board for XBee Module // XBee S1 // 2 x EasyDriver // 2 x Small Stepper // Adafruit PowerBoost 500 Shield // Lithium Ion Battery - 2Ah // LED Green // delayMicroseconds // Include the library code: // EEPROM library to read and write EEPROM with unique ID for unit #include <EEPROM.h> // Momentary Button int yy = ""; // 2 x EasyDriver - 2 x Stepper int dirPinR = 2; // EasyDriver Right int stepPinR = 3; // stepPin Right int dirPinL = 4; // EasyDriver Left int stepPinL = 5; // stepPin Left int i = 0; // LED Green int iLEDGreen = 6; // Process Message bool bStart = false; // Start bool bEnd = false; // End int incb = 0; // Variable to store the incoming byte String msg = ""; // Message String zzz = ""; byte in = 0; // Index int x = 0; // delayMicroseconds int dMicro = 0; // Software Version Information String sver = "12-09"; // Unit ID information String uid = ""; void loop() { // Check for serial messages if ( Serial.available() ) { isProcessMessage(); } // Switch isSwitch(); }
getEEPROM.ino
// EEPROM // isUID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getProcessMessage.ino
// ProcessMessage // isProcessMessage void isProcessMessage() { // Loop through serial buffer one byte at a time until you reach * which will be end of message while ( Serial.available() ) { // Read the incoming byte: incb = Serial.read(); // Start the message when the '<' symbol is received if(incb == '<') { bStart = true; in = 0; msg = ""; } // End the message when the '*' symbol is received else if(incb == '*') { bEnd = true; x = msg.length(); msg.remove( x , 1); break; // Done reading } // Read the message else { if(in < 8) // Make sure there is room { msg = msg + char(incb); in++; } } } if( bStart && bEnd) { // Stepper zzz = msg.charAt( 0 ); yy = zzz.toInt(); msg.remove( 0 , 2); // delayMicroseconds dMicro = msg.toInt() + 300; in = 0; zzz = ""; msg = ""; bStart = false; bEnd = false; } }
getStepper.ino
// Stepper // isStepperSetup void isStepperSetup() { // 2 x EasyDriver pinMode(dirPinR, OUTPUT); pinMode(stepPinR, OUTPUT); pinMode(dirPinL, OUTPUT); pinMode(stepPinL, OUTPUT); } // isStepper1 void isStepper1(){ // 2 x EasyDriver - Up digitalWrite(dirPinR, LOW); // Set the direction. digitalWrite(dirPinL, LOW); // Set the direction. digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(dMicro); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(dMicro); // This delay time is close to top speed. } // isStepper2 void isStepper2(){ // 2 x EasyDriver digitalWrite(dirPinR, HIGH); // Set the direction. digitalWrite(dirPinL, HIGH); // Set the direction. digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(dMicro); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(dMicro); // This delay time is close to top speed. } // Switch 3 void isStepper3(){ // Right // 2 x EasyDriver digitalWrite(dirPinR, LOW); // Set the direction. digitalWrite(dirPinL, HIGH); // Set the direction. delay(5); digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(dMicro); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(dMicro); // This delay time is close to top speed. } // Switch 4 void isStepper4(){ // Left // 2 x EasyDriver digitalWrite(dirPinR, HIGH); // Set the direction. digitalWrite(dirPinL, LOW); // Set the direction. digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(dMicro); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(dMicro); // This delay time is close to top speed. } // isStepperStop void isStepperStop() { // 2 x EasyDriver digitalWrite(dirPinR, LOW); // Set the direction. delay(5); digitalWrite(dirPinL, LOW); // Set the direction. delay(5); digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the }
getSwitch.ino
// Switch // isSwitch void isSwitch(){ switch ( yy ) { case 1: // Stepper 1 - Up isStepper1(); break; case 2: // Stepper 2 - Back isStepper2(); break; case 3: // Stepper 3 - Right isStepper3(); break; case 4: // Stepper 4 - Left isStepper4(); break; case 5: // Stepper Stop isStepperStop(); break; default: // Stepper Stop isStepperStop(); } }
setup.ino
// Setup void setup() { // Open the serial port at 9600 bps: Serial.begin( 9600 ); // Pause delay(5); // EEPROM Unit ID isUID(); // Pause delay(5); // 2 x EasyDriver isStepperSetup(); // LED Green pinMode(iLEDGreen, OUTPUT); digitalWrite(iLEDGreen, HIGH); }
Follow Us
J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: http://neosteamlabs.com/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Facebook: https://www.facebook.com/neosteam.labs.9/
Instagram: https://www.instagram.com/neosteamlabs/
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Twitter: https://twitter.com/labs_steam
Etsy: https://www.etsy.com/shop/NeoSteamLabs
Don Luc
Project #14: Components – Slide Pot (Small) – Knob – Mk03
——
——
——
——
Slide Pot – Small (10k Linear Taper)
SparkFun Item: COM-11620
A simple slide potentiometer can go a long way. Rated at 10KOhm and 0.1W. Comes with solder tab connections. The pot has an overall travel of 20mm and has two mounting holes on top.
Slide Potentiometer Knob
SparkFun Item: COM-14889
This is a simple knob that connects to the small and medium sized linear slide potentiometers. Each knob uses friction to secure itself to fit onto the slide pot. Once attached, this small knob provides you with an easier to use potentiometer for your project.
A printed circuit board (PCB) mechanically supports and electrically connects electrical or electronic components.
Follow Us
J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: http://neosteamlabs.com/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Facebook: https://www.facebook.com/neosteam.labs.9/
Instagram: https://www.instagram.com/neosteamlabs/
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Twitter: https://twitter.com/labs_steam
Etsy: https://www.etsy.com/shop/NeoSteamLabs
Don Luc
Project #12: Robotics – Unmanned Vehicles 1d – Mk08
——
——
——
——
——
——
DL2002Mk03
1 x Arduino UNO – R3
1 x Arduino UNO – SparkFun RedBoard
1 x ProtoScrewShield
1 x Adafruit RGB LCD Shield 16×2 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
1 x Adafruit PowerBoost 500 Shield
1 x Lithium Ion Battery – 2Ah
1 x LED Green
7 x Jumper Wires 3″ M/M
13 x Jumper Wires 6″ M/M
1 x Full-Size Breadboard
1 x SparkFun XBee Explorer USB
1 x DIGI XCTU Software
1 x SparkFun USB Mini-B Cable
1 x SparkFun Cerberus USB Cable
Arduino UNO
TX0 – Digital 1
RX0 – Digital 0
VIN – +5V
GND – GND
XBee S1: Transmitter
CH Channel: C
PAN Id: 3333
SH Serial Number: 13A200
SL Serial Number: 40717A1F
CE Coordinator: Coordinator
BD: 9600
DL2002Mk03p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #12: Robotics - Unmanned Vehicles 1d - Mk08 // 02-03 // DL2002Mk01p.ino 12-08 // Arduino UNO - R3 // ProtoScrewShield // Adafruit RGB LCD Shield 16×2 Character Display // EEPROM with Unique ID // Transmitter // XBee S1 // Stepper // Include the library code: // EEPROM library to read and write EEPROM with unique ID for unit #include <EEPROM.h> // Adafruit RGB LCD Shield #include <Adafruit_RGBLCDShield.h> // Adafruit RGB LCD Shield Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield(); // These #defines make it easy to set the backlight color #define OFF 0x0 #define RED 0x1 #define YELLOW 0x3 #define GREEN 0x2 #define TEAL 0x6 #define BLUE 0x4 #define VIOLET 0x5 #define WHITE 0x7 // Momentary Button int yy = 0; uint8_t momentaryButton = 0; // Communication unsigned long dTime = 50; // The current address in the EEPROM (i.e. which byte we're going to read to next) // Version String sver = "12-7.p"; // Unit ID Information String uid = ""; void loop() { // Clear RGBLCDShield.clear(); // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Robotics"); // Robotics // Momentary Button momentaryButton = RGBLCDShield.readButtons(); switch ( yy ) { case 1: // Up isSwitch1(); break; case 2: // Down isSwitch2(); break; case 3: // Right isSwitch3(); break; case 4: // Left isSwitch4(); break; case 5: // Stop isSwitch5(); break; default: // Stop yy = 5; RGBLCDShield.setBacklight(RED); isSwitch5(); } if ( momentaryButton ) { if ( momentaryButton & BUTTON_UP ) { yy = 1; // Up RGBLCDShield.setBacklight(GREEN); } if ( momentaryButton & BUTTON_DOWN ) { yy = 2; // Down RGBLCDShield.setBacklight(VIOLET); } if ( momentaryButton & BUTTON_LEFT ) { yy = 3; // Right RGBLCDShield.setBacklight(TEAL); } if ( momentaryButton & BUTTON_RIGHT ) { yy = 4; // Left RGBLCDShield.setBacklight(YELLOW); } if ( momentaryButton & BUTTON_SELECT ) { yy = 5; // Stop RGBLCDShield.setBacklight(RED); } } // Process Message isProcessMessage(); delay( dTime ); }
getEEPROM.ino
// EEPROM // isUID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getProcessMessage.ino
// ProcessMessage // isProcessMessage void isProcessMessage() { // String msg = ""; /// Loop through serial buffer one byte at a time until you reach * which will be end of message //while ( Serial.available() ) // { // Print => XBEE + Unit ID + Version + * // msg = "XBEE|" + uid + "|" + sver + "|" + yy + "|*"; Serial.print( '<' ); Serial.print( yy ); Serial.println( '*' ); // } }
getSwitch.ino
// Switch // Switch 1 void isSwitch1(){ yy = 1; // Stepper // Up RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Up"); } // Switch 2 void isSwitch2(){ yy = 2; // Stepper // Down RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Down"); } // Switch 3 void isSwitch3(){ yy = 3; // Stepper // Right RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Right"); } // Switch 4 void isSwitch4(){ yy = 4; // Stepper // Left RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Left"); } // Switch 5 void isSwitch5(){ yy = 5; // Stepper // Stop RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Stop"); }
setup.ino
// Setup void setup() { // Open serial port at 9600 baud Serial.begin( 9600 ); // Pause delay(5); // EEPROM Unit ID isUID(); // Pause delay(5); // Adafruit RGB LCD Shield // Set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); RGBLCDShield.setBacklight(GREEN); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc Electron"); // Don luc Electron // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("Robotics"); // Robotics // Serial // Serial.println( "Don Luc Electronics"); // Serial.println( "Robotics"); delay(5000); // Clear RGBLCDShield.clear(); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Version: "); // Version RGBLCDShield.print( sver ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("UID: "); // Unit ID Information RGBLCDShield.print( uid ); // Serial // Serial.print( "Software Version Information: "); // Serial.println( sver ); // Serial.print( "Unit ID Information: "); // Serial.println( uid ); delay(5000); // Clear RGBLCDShield.clear(); }
Arduino UNO – SparkFun RedBoard
LEG – Digital 6
SP1 – Digital 3
DI1 – Digital 2
SP2 – Digital 5
DI2 – Digital 4
TX0 – Digital 1
RX0 – Digital 0
VIN – +3.3V
GND – GND
XBee S1: Receiver
CH Channel: C
PAN Id: 3333
SH Serial Number: 13A200
SL Serial Number: 4076E2C5
CE Coordinator: End Device
BD: 9600
DL2002Mk03Rp.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #12: Robotics - Unmanned Vehicles 1d - Mk08 // 02-03 // DL2002Mk01Rp.ino 12-08 // Arduino UNO - SparkFun RedBoard // EEPROM with Unique ID // Receiver // Breakout Board for XBee Module // XBee S1 // 2 x EasyDriver // 2 x Small Stepper // Adafruit PowerBoost 500 Shield // Lithium Ion Battery - 2Ah // LED Green // Include the library code: // EEPROM library to read and write EEPROM with unique ID for unit #include <EEPROM.h> // Momentary Button int yy = ""; // 2 x EasyDriver - 2 x Stepper int dirPinR = 2; // EasyDriver Right int stepPinR = 3; // stepPin Right int dirPinL = 4; // EasyDriver Left int stepPinL = 5; // stepPin Left int i = 0; // LED Green int iLEDGreen = 6; // Software Version Information String sver = "12-08"; // Unit ID information String uid = ""; void loop() { // Check for serial messages if ( Serial.available() ) { isProcessMessage(); } // Switch isSwitch(); }
getEEPROM.ino
// EEPROM // isUID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getProcessMessage.ino
// ProcessMessage // isProcessMessage void isProcessMessage() { int incb = 0; String msg = ""; String zzz = ""; // Loop through serial buffer one byte at a time until you reach * which will be end of message while ( Serial.available() ) { // Read the incoming byte: incb = Serial.read(); // Add character to string msg = msg + char(incb); // Check if receive character is the end of message * if ( incb == 42 ) { // Serial.println(msg); zzz = msg.charAt( 1 ); // Serial.println(zzz); yy = zzz.toInt(); // Serial.println( yy ); } } }
getStepper.ino
// Stepper // isStepperSetup void isStepperSetup() { // 2 x EasyDriver pinMode(dirPinR, OUTPUT); pinMode(stepPinR, OUTPUT); pinMode(dirPinL, OUTPUT); pinMode(stepPinL, OUTPUT); } // isStepper1 void isStepper1(){ // 2 x EasyDriver - Up digitalWrite(dirPinR, LOW); // Set the direction. delay(5); digitalWrite(dirPinL, LOW); // Set the direction. delay(5); for (i = 0; i<300; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(300); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(300); // This delay time is close to top speed. } } // isStepper2 void isStepper2(){ // 2 x EasyDriver digitalWrite(dirPinR, HIGH); // Set the direction. delay(5); digitalWrite(dirPinL, HIGH); // Set the direction. delay(5); for (i = 0; i<1000; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(300); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(300); // This delay time is close to top speed. } } // Switch 3 void isStepper3(){ // Right // 2 x EasyDriver digitalWrite(dirPinR, LOW); // Set the direction. delay(5); digitalWrite(dirPinL, HIGH); // Set the direction. delay(5); for (i = 0; i<300; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(300); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(300); // This delay time is close to top speed. } } // Switch 4 void isStepper4(){ // Left // 2 x EasyDriver digitalWrite(dirPinR, HIGH); // Set the direction. delay(5); digitalWrite(dirPinL, LOW); // Set the direction. delay(5); for (i = 0; i<300; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(300); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(300); // This delay time is close to top speed. } } // isStepperStop void isStepperStop() { // 2 x EasyDriver digitalWrite(dirPinR, LOW); // Set the direction. delay(5); digitalWrite(dirPinL, LOW); // Set the direction. delay(5); digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the }
getSwitch.ino
// Switch // isSwitch void isSwitch(){ switch ( yy ) { case 1: // Stepper 1 - Up isStepper1(); break; case 2: // Stepper 2 - Back isStepper2(); break; case 3: // Stepper 3 - Right isStepper3(); break; case 4: // Stepper 4 - Left isStepper4(); break; case 5: // Stepper Stop isStepperStop(); break; default: // Stepper Stop isStepperStop(); } }
setup.ino
// Setup void setup() { // Open the serial port at 9600 bps: Serial.begin( 9600 ); // Pause delay(5); // EEPROM Unit ID isUID(); // Pause delay(5); // Serial // Serial.print( "Software Version Information: "); // Serial.println( sver ); // Serial.print( "Unit ID Information: "); // Serial.println( uid ); // delay(5000); // 2 x EasyDriver isStepperSetup(); // LED Green pinMode(iLEDGreen, OUTPUT); digitalWrite(iLEDGreen, HIGH); }
Follow Us
J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: http://neosteamlabs.com/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Facebook: https://www.facebook.com/neosteam.labs.9/
Instagram: https://www.instagram.com/neosteamlabs/
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Twitter: https://twitter.com/labs_steam
Etsy: https://www.etsy.com/shop/NeoSteamLabs
Don Luc
Project #12: Robotics – Unmanned Vehicles 1c – Mk07
——
——
——
——
——
DL2002Mk01
1 x Arduino UNO – R3
1 x Arduino UNO – SparkFun RedBoard
1 x ProtoScrewShield
1 x Adafruit RGB LCD Shield 16×2 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
6 x Jumper Wires 3″ M/M
12 x Jumper Wires 6″ M/M
1 x Full-Size Breadboard
1 x SparkFun XBee Explorer USB
1 x DIGI XCTU Software
1 x SparkFun USB Mini-B Cable
1 x SparkFun Cerberus USB Cable
Arduino UNO
TX0 – Digital 1
RX0 – Digital 0
VIN – +5V
GND – GND
XBee S1: Transmitter
CH Channel: C
PAN Id: 3333
SH Serial Number: 13A200
SL Serial Number: 40717A1F
CE Coordinator: Coordinator
BD: 9600
DL2002Mk01p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #12: Robotics - Unmanned Vehicles 1c - Mk07 // 02-01 // DL2002Mk01p.ino 12-07 // Arduino UNO - R3 // ProtoScrewShield // Adafruit RGB LCD Shield 16×2 Character Display // EEPROM with Unique ID // Transmitter // XBee S1 // Stepper // Include the library code: // EEPROM library to read and write EEPROM with unique ID for unit #include <EEPROM.h> // Adafruit RGB LCD Shield #include <Adafruit_RGBLCDShield.h> // Adafruit RGB LCD Shield Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield(); // These #defines make it easy to set the backlight color #define OFF 0x0 #define RED 0x1 #define YELLOW 0x3 #define GREEN 0x2 #define TEAL 0x6 #define BLUE 0x4 #define VIOLET 0x5 #define WHITE 0x7 // Momentary Button int yy = 0; uint8_t momentaryButton = 0; // Communication unsigned long dTime = 50; // The current address in the EEPROM (i.e. which byte we're going to read to next) // Version String sver = "12-7.p"; // Unit ID Information String uid = ""; void loop() { // Clear RGBLCDShield.clear(); // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Robotics"); // Robotics // Momentary Button momentaryButton = RGBLCDShield.readButtons(); switch ( yy ) { case 1: // Up isSwitch1(); break; case 2: // Down isSwitch2(); break; case 3: // Right isSwitch3(); break; case 4: // Left isSwitch4(); break; case 5: // Stop isSwitch5(); break; default: // Stop yy = 5; RGBLCDShield.setBacklight(RED); isSwitch5(); } if ( momentaryButton ) { if ( momentaryButton & BUTTON_UP ) { yy = 1; // Up RGBLCDShield.setBacklight(GREEN); } if ( momentaryButton & BUTTON_DOWN ) { yy = 2; // Down RGBLCDShield.setBacklight(VIOLET); } if ( momentaryButton & BUTTON_LEFT ) { yy = 3; // Right RGBLCDShield.setBacklight(TEAL); } if ( momentaryButton & BUTTON_RIGHT ) { yy = 4; // Left RGBLCDShield.setBacklight(YELLOW); } if ( momentaryButton & BUTTON_SELECT ) { yy = 5; // Stop RGBLCDShield.setBacklight(RED); } } // Process Message isProcessMessage(); delay( dTime ); }
getEEPROM.ino
// EEPROM // isUID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getProcessMessage.ino
// ProcessMessage // isProcessMessage void isProcessMessage() { // String msg = ""; /// Loop through serial buffer one byte at a time until you reach * which will be end of message //while ( Serial.available() ) // { // Print => XBEE + Unit ID + Version + * // msg = "XBEE|" + uid + "|" + sver + "|" + yy + "|*"; Serial.print( '<' ); Serial.print( yy ); Serial.println( '*' ); // } }
getSwitch.ino
// Switch // Switch 1 void isSwitch1(){ yy = 1; // Stepper // Up RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Up"); } // Switch 2 void isSwitch2(){ yy = 2; // Stepper // Down RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Down"); } // Switch 3 void isSwitch3(){ yy = 3; // Stepper // Right RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Right"); } // Switch 4 void isSwitch4(){ yy = 4; // Stepper // Left RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Left"); } // Switch 5 void isSwitch5(){ yy = 5; // Stepper // Stop RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Stop"); }
setup.ino
// Setup void setup() { // Open serial port at 9600 baud Serial.begin( 9600 ); // Pause delay(5); // EEPROM Unit ID isUID(); // Pause delay(5); // Adafruit RGB LCD Shield // Set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); RGBLCDShield.setBacklight(GREEN); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc Electron"); // Don luc Electron // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("Robotics"); // Robotics // Serial // Serial.println( "Don Luc Electronics"); // Serial.println( "Robotics"); delay(5000); // Clear RGBLCDShield.clear(); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Version: "); // Version RGBLCDShield.print( sver ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("UID: "); // Unit ID Information RGBLCDShield.print( uid ); // Serial // Serial.print( "Software Version Information: "); // Serial.println( sver ); // Serial.print( "Unit ID Information: "); // Serial.println( uid ); delay(5000); // Clear RGBLCDShield.clear(); }
Arduino UNO – SparkFun RedBoard
SP1 – Digital 3
DI1 – Digital 2
SP2 – Digital 5
DI2 – Digital 4
TX0 – Digital 1
RX0 – Digital 0
VIN – +3.3V
GND – GND
XBee S1: Receiver
CH Channel: C
PAN Id: 3333
SH Serial Number: 13A200
SL Serial Number: 4076E2C5
CE Coordinator: End Device
BD: 9600
DL2002Mk01Rp.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #12: Robotics - Unmanned Vehicles 1c - Mk07 // 02-01 // DL2002Mk01Rp.ino 12-07 // Arduino UNO - SparkFun RedBoard // EEPROM with Unique ID // Receiver // Breakout Board for XBee Module // XBee S1 // 2 x EasyDriver // 2 x Small Stepper // Include the library code: // EEPROM library to read and write EEPROM with unique ID for unit #include <EEPROM.h> // Momentary Button int yy = ""; // 2 x EasyDriver - 2 x Stepper int dirPinR = 2; // EasyDriver Right int stepPinR = 3; // stepPin Right int dirPinL = 4; // EasyDriver Left int stepPinL = 5; // stepPin Left int i = 0; // Software Version Information String sver = "12-07"; // Unit ID information String uid = ""; void loop() { // Check for serial messages if ( Serial.available() ) { isProcessMessage(); } // Switch isSwitch(); }
getEEPROM.ino
// EEPROM // isUID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getProcessMessage.ino
// ProcessMessage // isProcessMessage void isProcessMessage() { int incb = 0; String msg = ""; String zzz = ""; // Loop through serial buffer one byte at a time until you reach * which will be end of message while ( Serial.available() ) { // Read the incoming byte: incb = Serial.read(); // Add character to string msg = msg + char(incb); // Check if receive character is the end of message * if ( incb == 42 ) { // Serial.println(msg); zzz = msg.charAt( 1 ); // Serial.println(zzz); yy = zzz.toInt(); // Serial.println( yy ); } } }
getStepper.ino
// Stepper // isStepperSetup void isStepperSetup() { // 2 x EasyDriver pinMode(dirPinR, OUTPUT); pinMode(stepPinR, OUTPUT); pinMode(dirPinL, OUTPUT); pinMode(stepPinL, OUTPUT); } // isStepper1 void isStepper1(){ // 2 x EasyDriver - Up digitalWrite(dirPinR, LOW); // Set the direction. delay(5); digitalWrite(dirPinL, LOW); // Set the direction. delay(5); for (i = 0; i<300; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(300); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(300); // This delay time is close to top speed. } } // isStepper2 void isStepper2(){ // 2 x EasyDriver digitalWrite(dirPinR, HIGH); // Set the direction. delay(5); digitalWrite(dirPinL, HIGH); // Set the direction. delay(5); for (i = 0; i<1000; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(300); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(300); // This delay time is close to top speed. } } // Switch 3 void isStepper3(){ // Right // 2 x EasyDriver digitalWrite(dirPinR, LOW); // Set the direction. delay(5); digitalWrite(dirPinL, HIGH); // Set the direction. delay(5); for (i = 0; i<300; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(300); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(300); // This delay time is close to top speed. } } // Switch 4 void isStepper4(){ // Left // 2 x EasyDriver digitalWrite(dirPinR, HIGH); // Set the direction. delay(5); digitalWrite(dirPinL, LOW); // Set the direction. delay(5); for (i = 0; i<300; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(300); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(300); // This delay time is close to top speed. } } // isStepperStop void isStepperStop() { // 2 x EasyDriver digitalWrite(dirPinR, LOW); // Set the direction. delay(5); digitalWrite(dirPinL, LOW); // Set the direction. delay(5); digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the }
getSwitch.ino
// Switch // isSwitch void isSwitch(){ switch ( yy ) { case 1: // Stepper 1 - Up isStepper1(); break; case 2: // Stepper 2 - Back isStepper2(); break; case 3: // Stepper 3 - Right isStepper3(); break; case 4: // Stepper 4 - Left isStepper4(); break; case 5: // Stepper Stop isStepperStop(); break; default: // Stepper Stop isStepperStop(); } }
setup.ino
// Setup void setup() { // Open the serial port at 9600 bps: Serial.begin( 9600 ); // Pause delay(5); // EEPROM Unit ID isUID(); // Pause delay(5); // Serial // Serial.print( "Software Version Information: "); // Serial.println( sver ); // Serial.print( "Unit ID Information: "); // Serial.println( uid ); // delay(5000); // 2 x EasyDriver isStepperSetup(); }
Follow Us
J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: http://neosteamlabs.com/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Facebook: https://www.facebook.com/neosteam.labs.9/
Instagram: https://www.instagram.com/neosteamlabs/
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Twitter: https://twitter.com/labs_steam
Etsy: https://www.etsy.com/shop/NeoSteamLabs
Don Luc
Project #12: Robotics – Unmanned Vehicles 1b – Mk06
——
——
——
——
——
XBee
Digi XBee is the brand name of a family of form factor compatible radio modules from Digi International. The first XBee radios were introduced under the MaxStream brand in 2005 and were based on the IEEE 802.15.4-2003 standard designed for point-to-point and star communications at over-the-air baud rates of 250 kbit/s.
Two models were initially introduced, a lower cost 1 mW XBee and the higher power 100 mW XBee-PRO. Since the initial introduction, a number of new XBee radios have been introduced and an ecosystem of wireless modules, gateways, adapters and software has evolved.
The XBee radios can all be used with the minimum number of connections — power (3.3 V), ground, data in and data out (UART), with other recommended lines being Reset and Sleep. Additionally, most XBee families have some other flow control, input/output (I/O), analog-to-digital converter (A/D) and indicator lines built in.
DL2001Mk02
1 x Arduino Fio
1 x Arduino UNO – R3
1 x ProtoScrewShield
1 x Adafruit RGB LCD Shield 16×2 Character Display
2 x XBee S1
1 x SparkFun XBee Explorer Regulated
1 x Lithium Ion Battery – 2.5Ah
1 x LED Red
1 x LED Green
1 x LED Bi-Colour
1 x LED Yellow
4 x Jumper Wires 3″ M/M
10 x Jumper Wires 6″ M/M
1 x Half-Size Breadboard
1 x SparkFun XBee Explorer USB
1 x DIGI XCTU Software
1 x SparkFun FTDI Basic Breakout – 3.3V
1 x SparkFun Cerberus USB Cable
Arduino UNO
TX0 – Digital 1
RX0 – Digital 0
VIN – +5V
GND – GND
XBee S1: Transmitter
CH Channel: C
PAN Id: 3333
SH Serial Number: 13A200
SL Serial Number: 40717A1F
CE Coordinator: Coordinator
BD: 9600
DL2001Mk02p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #12: Robotics - Unmanned Vehicles 1b - Mk06 // 01-02 // DL2001Mk01p.ino 12-06 // Arduino UNO - R3 // ProtoScrewShield // Adafruit RGB LCD Shield 16×2 Character Display // EEPROM with Unique ID // Transmitter // XBee S1 // Include the library code: // EEPROM library to read and write EEPROM with unique ID for unit #include <EEPROM.h> // Adafruit RGB LCD Shield #include <Adafruit_RGBLCDShield.h> // Adafruit RGB LCD Shield Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield(); // These #defines make it easy to set the backlight color #define OFF 0x0 #define RED 0x1 #define YELLOW 0x3 #define GREEN 0x2 #define TEAL 0x6 #define BLUE 0x4 #define VIOLET 0x5 #define WHITE 0x7 // Momentary Button int yy = 0; uint8_t momentaryButton = 0; // Communication unsigned long dTime = 1000; // The current address in the EEPROM (i.e. which byte we're going to read to next) // Version String sver = "12-2.p"; // Unit ID Information String uid = ""; void loop() { // Clear RGBLCDShield.clear(); // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Robotics"); // Robotics // Momentary Button momentaryButton = RGBLCDShield.readButtons(); switch ( yy ) { case 1: // LED Green isSwitch1(); break; case 2: // LED Bipolar (Green) isSwitch2(); break; case 3: // Right isSwitch3(); break; case 4: // Left isSwitch4(); break; case 5: // LED Red isSwitch5(); break; default: // LED Red yy = 5; RGBLCDShield.setBacklight(RED); isSwitch5(); } if ( momentaryButton ) { if ( momentaryButton & BUTTON_UP ) { yy = 1; // LED Green RGBLCDShield.setBacklight(GREEN); } if ( momentaryButton & BUTTON_DOWN ) { yy = 2; // LED Bipolar A RGBLCDShield.setBacklight(VIOLET); } if ( momentaryButton & BUTTON_LEFT ) { yy = 3; // LED Bipolar B RGBLCDShield.setBacklight(TEAL); } if ( momentaryButton & BUTTON_RIGHT ) { yy = 4; // LED Bipolar A B RGBLCDShield.setBacklight(YELLOW); } if ( momentaryButton & BUTTON_SELECT ) { yy = 5; // LED Red RGBLCDShield.setBacklight(RED); } } // Process Message isProcessMessage(); delay( dTime ); }
getEEPROM.ino
// EEPROM // isUID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getProcessMessage.ino
// ProcessMessage // isProcessMessage void isProcessMessage() { //int incb = 0; String msg = ""; /// Loop through serial buffer one byte at a time until you reach * which will be end of message //while ( Serial.available() ) // { // Print => XBEE + Unit ID + Version + * msg = "XBEE|" + uid + "|" + sver + "|" + yy + "|*"; Serial.println( msg ); // } }
getSwitch.ino
// Switch // Switch 1 void isSwitch1(){ yy = 1; isSwitchLEDStop(); // LED // turn LED on: RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Green"); } // Switch 2 void isSwitch2(){ yy = 2; isSwitchLEDStop(); // LED // turn LED on: RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Bi-Colour A"); } // Switch 3 void isSwitch3(){ yy = 3; isSwitchLEDStop(); // LED // turn LED on: RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Bi-Colour B"); } // Switch 4 void isSwitch4(){ yy = 4; isSwitchLEDStop(); // LED // turn LED on: RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Bi-Colour A B"); } // Switch 5 void isSwitch5(){ yy = 5; RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Stop"); //delay( 250 ); isSwitchLEDStop(); // LED // turn LED on: //digitalWrite(iLEDRed, HIGH); } void isSwitchLEDStop(){ //digitalWrite(iLEDRed, LOW); //digitalWrite(iLEDGreen, LOW); //digitalWrite(iLEDB1, LOW); //digitalWrite(iLEDB2, LOW); //digitalWrite(iLEDYellow, LOW); }
setup.ino
// Setup void setup() { //Open serial port at 9600 baud Serial.begin( 9600 ); // Pause delay(5); // EEPROM Unit ID isUID(); // Pause delay(5); // Adafruit RGB LCD Shield // Set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); RGBLCDShield.setBacklight(GREEN); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc Electron"); // Don luc Electron // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("Robotics"); // Robotics // Serial Serial.println( "Don Luc Electronics"); Serial.println( "Robotics"); delay(5000); // Clear RGBLCDShield.clear(); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Version: "); // Version RGBLCDShield.print( sver ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("UID: "); // Unit ID Information RGBLCDShield.print( uid ); // Serial Serial.print( "Software Version Information: "); Serial.println( sver ); Serial.print( "Unit ID Information: "); Serial.println( uid ); delay(5000); // Clear RGBLCDShield.clear(); }
Arduino Fio
LER – Digital 13
LEG – Digital 12
LEA – Digital 11
LEB – Digital 10
LEY – Digital 9
TX0 – Digital 1
RX0 – Digital 0
VIN – +3.3V
GND – GND
XBee S1: Receiver
CH Channel: C
PAN Id: 3333
SH Serial Number: 13A200
SL Serial Number: 4076E2C5
CE Coordinator: End Device
BD: 9600
DL2001Mk02Rp.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #12: Robotics - Unmanned Vehicles 1b - Mk06 // 01-02 // DL2001Mk02Rp.ino 12-06 // Arduino Fio // SparkFun FTDI Basic Breakout - 3.3V // EEPROM with Unique ID // LED Red // LED Green // LED Bi-Colour // LED Yellow // Lithium Ion Battery - 2.5Ah // Receiver // XBee S1 // Include the library code: // EEPROM library to read and write EEPROM with unique ID for unit #include <EEPROM.h> // LED Red int iLEDRed = 13; // LED Green int iLEDGreen = 12; // LED Bi-Colour int iLEDBiCoA = 11; int iLEDBiCoB = 10; // LED Yellow int iLEDYellow = 9; // Momentary Button int yy = ""; // Software Version Information String sver = "12-02"; // Unit ID information String uid = "DR001"; void loop() { // Check for serial messages if ( Serial.available() ) { isProcessMessage(); } // Switch isSwitch(); }
getEEPROM.ino
// EEPROM // isUID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getProcessMessage.ino
// ProcessMessage // isProcessMessage void isProcessMessage() { int incb = 0; String msg = ""; String zzz = ""; // Loop through serial buffer one byte at a time until you reach * which will be end of message while ( Serial.available() ) { // Read the incoming byte: incb = Serial.read(); // Add character to string msg = msg + char(incb); // Check if receive character is the end of message * if ( incb == 42 ) { Serial.println(msg); zzz = msg.charAt( 18 ); Serial.println(zzz); yy = zzz.toInt(); Serial.println( yy ); } } }
getSwitch.ino
// Switch // isSwitch void isSwitch(){ switch ( yy ) { case 1: // LED Green sLEDStop(); digitalWrite(iLEDGreen, HIGH); delay( 1000 ); break; case 2: // LED Bi-Colour A sLEDStop(); digitalWrite(iLEDBiCoA, HIGH); delay( 1000 ); break; case 3: // LED Bi-Colour B sLEDStop(); digitalWrite(iLEDBiCoB, HIGH); delay( 1000 ); break; case 4: // LED Bi-Colour A B sLEDStop(); digitalWrite(iLEDBiCoA, HIGH); digitalWrite(iLEDBiCoB, HIGH); delay( 1000 ); break; case 5: // LED Red sLEDStop(); digitalWrite(iLEDRed, HIGH); delay( 1000 ); break; default: // LED Red sLEDStop(); digitalWrite(iLEDRed, HIGH); delay( 1000 ); } } // LED Stop void sLEDStop(){ digitalWrite(iLEDRed, LOW); digitalWrite(iLEDGreen, LOW); digitalWrite(iLEDBiCoA, LOW); digitalWrite(iLEDBiCoB, LOW); }
setup.ino
// Setup void setup() { // Open the serial port at 9600 bps: Serial.begin( 9600 ); // Pause delay(5); // EEPROM Unit ID isUID(); // Pause delay(5); // Serial Serial.print( "Software Version Information: "); Serial.println( sver ); Serial.print( "Unit ID Information: "); Serial.println( uid ); delay(5000); // LED => OUTPUT pinMode(iLEDRed, OUTPUT); pinMode(iLEDGreen, OUTPUT); pinMode(iLEDBiCoA, OUTPUT); pinMode(iLEDBiCoB, OUTPUT); pinMode(iLEDYellow, OUTPUT); // LED Yellow digitalWrite(iLEDYellow, HIGH); }
Follow Us
J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: http://neosteamlabs.com/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Facebook: https://www.facebook.com/neosteam.labs.9/
Instagram: https://www.instagram.com/neosteamlabs/
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Twitter: https://twitter.com/labs_steam
Etsy: https://www.etsy.com/shop/NeoSteamLabs
Don Luc
Project #12: Robotics – Unmanned Vehicles 1a – Mk05
——
——
——
——
——
——
——
EEPROM
EEPROM stands for electrically erasable programmable read-only memory and is a type of non-volatile memory used in computers, integrated in microcontrollers for smart cards and remote keyless systems, and other electronic devices to store relatively small amounts of data but allowing individual bytes to be erased and reprogrammed.
Transmitter
In electronics and telecommunications a transmitter or radio transmitter is an electronic device which produces radio waves with an antenna. The transmitter itself generates a radio frequency alternating current, which is applied to the antenna. When excited by this alternating current, the antenna radiates radio waves.
Receiver
A modern communications receiver, used in two-way radio communication stations to talk with remote locations by shortwave radio.
In radio communications, a radio receiver, also known as a receiver, wireless or simply radio is an electronic device that receives radio waves and converts the information carried by them to a usable form. It is used with an antenna. The antenna intercepts radio waves (electromagnetic waves) and converts them to tiny alternating currents which are applied to the receiver, and the receiver extracts the desired information.
DL2001Mk01
1 x Arduino Fio
1 x Arduino UNO
1 x SparkFun FTDI Basic Breakout – 3.3V
1 x SparkFun Cerberus USB Cable
Arduino UNO
VIN – +5V
GND – GND
Arduino Fio
VIN – +3.3V
GND – GND
Transmitter => DT001
DL2001Mk01p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #12: Robotics - Unmanned Vehicles 1a - Mk05 // 01-01 // DL2001Mk01p.ino 12-05 // Arduino UNO // Screw Shield // Adafruit RGB LCD Shield // EEPROM with Unique ID // Transmitter // Include the library code: #include <Adafruit_RGBLCDShield.h> // EEPROM library to read and write EEPROM with unique ID for unit #include <EEPROM.h> // Adafruit RGB LCD Shield Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield(); // These #defines make it easy to set the backlight color #define GREEN 0x2 // Momentary Button int yy = 0; uint8_t momentaryButton = 0; // Software Version Information String sver = "12-05"; // Unit ID Information String uid = "DT001"; void loop() { // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc Electron"); // Don luc Electron momentaryButton = RGBLCDShield.readButtons(); if ( momentaryButton ) { if ( momentaryButton & BUTTON_UP ) { isEEPROMw(); yy = 1; } if ( momentaryButton & BUTTON_DOWN ) { isUID(); yy = 2; } if ( momentaryButton & BUTTON_LEFT ) { UIDr(); yy =3; } if ( momentaryButton & BUTTON_RIGHT ) { isEEPROMc(); yy = 4; } } delay(1000); // Clear RGBLCDShield.clear(); }
getEEPROM.ino
// getEEPROM // Write and Read EEPROM with Unique ID for Unit // Write EEPROM with Unique ID for Unit void isEEPROMw() { // set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print( "Write" ); // EEPROM int incb = 0; int v = 0; String msg = ""; String emp = ""; // Set Unit ID // The message starts with sid then is followed by 5 characters // First clear a string buffer emp = ""; // Loop through the 5 ID characters and write their ASCII (byte) value to the EEPROM for (int x = 0; x < 5; x++) { //Get ASCII value of character v = int(uid.charAt(x)); // + 5)); //Add the actual character to the buffer so we can send it back to the PC emp = emp + uid.charAt(x + 5); //Write the value to the EEPROM EEPROM.write(x, v); } delay( 5000 ); } // Read EEPROM with Unique ID for Unit void isUID() { // Unit ID String ruid = ""; for (int x = 0; x < 5; x++) { ruid = ruid + char(EEPROM.read(x)); } // set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print( ruid ); delay( 5000 ); } // Read uid void UIDr() { // set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print( uid ); delay( 5000 ); } // Clear EEPROM void isEEPROMc() { // Clear EEPROM for (int i = 0 ; i < EEPROM.length() ; i++) { EEPROM.write(i, 0); } // set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print( "Clear EEPROM" ); delay( 5000 ); }
setup.ino
// Setup void setup() { // Adafruit RGB LCD Shield // Set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); RGBLCDShield.setBacklight(GREEN); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc Electron"); // Don luc Electron // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("Unique ID"); // Unique ID delay(5000); // Clear RGBLCDShield.clear(); }
Receiver => DR001
DL2001Mk01Rp.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #12: Robotics - Unmanned Vehicles 1a - Mk05 // 01-01 // DL2001Mk01Rp.ino 12-05 // Arduino Fio // SparkFun FTDI Basic Breakout - 3.3V // EEPROM with Unique ID // Receiver // Include the library code: // EEPROM library to read and write EEPROM with unique ID for unit #include <EEPROM.h> // Software Version Information String sver = "12-05"; // Unit ID information String uid = "DR001"; void loop() { // Write EEPROM with Unique ID for Unit int incb = 0; int v = 0; String emp = ""; String ruid = ""; // Set Unit ID // The message starts with uid then is followed by 5 characters // First clear a string buffer emp = ""; // Loop through the 5 ID characters and write their ASCII (byte) value to the EEPROM for (int y = 0; y < 5; y++) { // Get ASCII value of character v = int(uid.charAt(y)); // + 5)); // Add the actual character to the buffer emp = emp + uid.charAt(y + 5); // Write the value to the EEPROM EEPROM.write(y, v); } // Write EEPROM with Unique ID for Unit Serial.println( "Write ID Information"); // Read ID Information // Unit ID for (int y = 0; y < 5; y++) { ruid = ruid + char(EEPROM.read(y)); } // Read ID Information Serial.print( "Read ID Information: "); Serial.println( ruid ); Serial.println( "Ok!" ); ruid = ""; delay( 5000 ); }
setup.ino
// Setup void setup() { // Open the serial port at 9600 bps: Serial.begin(9600); // Serial Serial.print( "Software Version Information: "); Serial.println( sver ); Serial.print( "Unit ID Information: "); Serial.println( uid ); delay(5000); }
Follow Us
J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: http://neosteamlabs.com/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Facebook: https://www.facebook.com/neosteam.labs.9/
Instagram: https://www.instagram.com/neosteamlabs/
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Twitter: https://twitter.com/labs_steam
Etsy: https://www.etsy.com/shop/NeoSteamLabs
Don Luc
Project #12: Robotics – 5-Way Switch – Mk04
——
——
——
——
——
——
——
SparkFun 5-Way Tactile Switch Breakout
This 5-way tactile switch (up, down, left, right, and center click) allows for joystick-like control in a very small package.
DL1912Mk03
1 x Adafruit RGB LCD Shield 16×2 Character Display
1 x Arduino UNO – R3
1 x ProtoScrewShield
2 x EasyDriver – Stepper Motor Driver
1 x Small Stepper Motor
1 x Pololu Mounting
1 x Symbol Stepper Motor
2 x RC Servo Motor
2 x Potentiometer 1M Ohm
2 x Knob
2 x LED Red
1 x Rocker Switches
1 x Laser Red
1 x SparkFun 5-Way Tactile Switch Breakout
1 x LED Green
1 x LED Bi-Colour
1 x LED Yellow
17 x Jumper Wires 3″ M/M
31 x Jumper Wires 6″ M/M
4 x Half-Size Breadboard
Arduino UNO
SP1 – Digital 3
DI1 – Digital 2
SP2 – Digital 5
DI2 – Digital 4
SV1 – Digital 6
PO1 – Analog A0
SV2 – Digital 7
PO2 – Analog A1
VIN – +5V
GND – GND
DL1912Mk03.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #12: Robotics - 5-Way Switch - Mk04 // 12-03 // DL1912Mk02p.ino 12-04 // Arduino UNO // Screw Shield // Adafruit RGB LCD Shield // 1 x Small Stepper Motor // 1 x Symbol Stepper Motor // 2 x EasyDriver // 2 x RC Servo Motor // 2 x Potentiometer // 2 x LED Red // 1 x Rocker Switches // 1 x Laser Red // 1 x SparkFun 5-Way Tactile Switch Breakout // 1 x LED Green // 1 x LED Bi-Colour // 1 x LED Yellow // include the library code: #include <Adafruit_RGBLCDShield.h> #include <Servo.h> // Adafruit RGB LCD Shield Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield(); // These #defines make it easy to set the backlight color #define OFF 0x0 #define RED 0x1 #define YELLOW 0x3 #define GREEN 0x2 #define TEAL 0x6 #define BLUE 0x4 #define VIOLET 0x5 #define WHITE 0x7 // Momentary Button int yy = 0; uint8_t momentaryButton = 0; // 2 x EasyDriver int dirPinR = 2; // EasyDriver Right int stepPinR = 3; // stepPin Right int dirPinL = 4; // EasyDriver Left int stepPinL = 5; // stepPin Left int i = 0; // 2 x RC Servo Motor // 2 x Potentiometer Servo isRCServo1; // Create servo object to control a RCServo1 int servo1 = 6; // Servo 1 int iPot1 = A0; // Analog Potentiometer 1 int iVal1; // Variable - Analog Potentiometer 1 Servo isRCServo2; // Create servo object to control a RCServo2 int servo2 = 7; // Servo 2 int iPot2 = A1; // Analog Potentiometer 2 int iVal2; // Variable - Analog Potentiometer 2 void loop() { // Clear RGBLCDShield.clear(); // Momentary Button momentaryButton = RGBLCDShield.readButtons(); switch ( yy ) { case 1: // Up isSwitch1(); break; case 2: // Down isSwitch2(); break; case 3: // Right isSwitch3(); break; case 4: // Left isSwitch4(); break; case 5: // Stop isSwitch5(); break; default: // Stop yy = 5; RGBLCDShield.setBacklight(RED); isSwitch5(); } if ( momentaryButton ) { if ( momentaryButton & BUTTON_UP ) { yy = 1; // Up RGBLCDShield.setBacklight(GREEN); } if ( momentaryButton & BUTTON_DOWN ) { yy = 2; // Down RGBLCDShield.setBacklight(VIOLET); } if ( momentaryButton & BUTTON_LEFT ) { yy = 3; // Right RGBLCDShield.setBacklight(TEAL); } if ( momentaryButton & BUTTON_RIGHT ) { yy = 4; // Left RGBLCDShield.setBacklight(YELLOW); } if ( momentaryButton & BUTTON_SELECT ) { yy = 5; // Stop RGBLCDShield.setBacklight(RED); } } }
getServo.ino
// Servo // isServoSetup void isServoSetup() { // 2 x RC Servo Motor isRCServo1.attach( servo1 ); isRCServo2.attach( servo2 ); } // isServo1 void isServo1() { // EasyDriver isStepperStop(); // Potentiometer RC Servo Motor 1 iVal1 = analogRead( iPot1 ); // Reads the value of the iPot1 (Value between 0 and 1023) iVal1 = map(iVal1, 0, 1023, 0, 180); // Scale it to use it with the isRCServo1 (Value between 0 and 180) isRCServo1.write( iVal1 ); // isRCServo1 sets the servo position according to the scaled value delay(15); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("RC Servo 1"); // RC Servo 1 // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print( iVal1 ); // Reads the value iVal1 delay(500); } // isServo2 void isServo2() { // EasyDriver isStepperStop(); // Potentiometer RC Servo Motor 1 iVal2 = analogRead( iPot2 ); // Reads the value of the iPot2 (Value between 0 and 1023) iVal2 = map(iVal2, 0, 1023, 0, 180); // Scale it to use it with the isRCServo2 (Value between 0 and 180) isRCServo2.write( iVal2 ); // isRCServo2 sets the servo position according to the scaled value delay(15); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("RC Servo 2"); // RC Servo 2 // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print( iVal2 ); // Reads the value iVal2 delay(500); }
getStepper.ino
// Stepper // isStepperSetup void isStepperSetup() { // 2 x EasyDriver pinMode(dirPinR, OUTPUT); pinMode(stepPinR, OUTPUT); pinMode(dirPinL, OUTPUT); pinMode(stepPinL, OUTPUT); } // isStepper1 void isStepper1(){ // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("EasyDriver"); // EasyDriver RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Small Stepper"); // Small Stepper delay(500); // EasyDriver digitalWrite(dirPinR, LOW); // Set the direction. delay(100); for (i = 0; i<300; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(170); // This delay time is close to top speed. } } // isStepper2 void isStepper2(){ // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("EasyDriver"); // EasyDriver RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Symbol Stepper"); // Symbol Stepper delay(500); // EasyDriver digitalWrite(dirPinL, HIGH); // Set the direction. delay(100); for (i = 0; i<300; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(170); // This delay time is close to top speed. } } // isStepperStop void isStepperStop() { // 2 x EasyDriver digitalWrite(dirPinR, LOW); // Set the direction. delay(100); digitalWrite(dirPinL, LOW); // Set the direction. delay(100); digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the }
getSwitch.ino
// Switch // Switch 1 void isSwitch1(){ // Small Stepper yy = 1; // EasyDriver isStepper1(); } // Switch 2 void isSwitch2(){ // Symbol Stepper yy = 2; // EasyDriver isStepper2(); } // Switch 3 void isSwitch3(){ // RC Servo Motor 1 yy = 3; // Potentiometer RC Servo Motor 1 isServo1(); } // Switch 4 void isSwitch4(){ // RC Servo Motor 2 yy = 4; // Potentiometer RC Servo Motor 2 isServo2(); } // Switch 5 void isSwitch5(){ // Stop yy = 5; // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Robotics"); // Robotics RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Stop"); delay( 500 ); // EasyDriver isStepperStop(); }
setup.ino
// Setup void setup() { // Adafruit RGB LCD Shield // Set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); RGBLCDShield.setBacklight(GREEN); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc Electron"); // Don luc Electron // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("Robotics"); // EasyDriver delay(5000); // Clear RGBLCDShield.clear(); // 2 x EasyDriver isStepperSetup(); // 2 x RC Servo Motor isServoSetup(); }
Follow Us
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: http://neosteamlabs.com/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Facebook: https://www.facebook.com/neosteam.labs.9/
Instagram: https://www.instagram.com/neosteamlabs/
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Twitter: https://twitter.com/labs_steam
Etsy: https://www.etsy.com/shop/NeoSteamLabs
Don Luc
Project #12: Robotics – Laser Diode – Mk03
——
——
——
——
——
——
Laser Diode
A laser diode is a semiconductor device similar to a light-emitting diode in which a diode pumped directly with electrical current can create lasing conditions at the diode’s junction. Laser diodes can directly convert electrical energy into light. Due to the drop of the electron from a higher energy level to a lower one, radiation, in the form of an emitted photon is generated. This is spontaneous emission. Stimulated emission can be produced when the process is continued and further generate light with the same phase, coherence and wavelength.
The choice of the semiconductor material determines the wavelength of the emitted beam, which in today’s laser diodes range from infra-red to the UV spectrum. Laser diodes are the most common type of lasers produced, with a wide range of uses that include fiber optic communications, barcode readers, laser pointers, CD/DVD/Blu-ray disc reading/recording, laser printing, laser scanning and light beam illumination. With the use of a phosphor like that found on white LEDs, Laser diodes can be used for general illumination.
DL1912Mk02
1 x Adafruit RGB LCD Shield 16×2 Character Display
1 x Arduino UNO – R3
1 x ProtoScrewShield
2 x EasyDriver – Stepper Motor Driver
1 x Small Stepper Motor
1 x Pololu Mounting
1 x Symbol Stepper Motor
2 x RC Servo Motor
2 x Potentiometer 1M Ohm
2 x Knob
1 x LED Red
1 x Rocker Switches
1 x Laser Red
5 x Jumper Wires 3″ M/M
29 x Jumper Wires 6″ M/M
3 x Half-Size Breadboard
Arduino UNO
SP1 – Digital 3
DI1 – Digital 2
SP2 – Digital 5
DI2 – Digital 4
SV1 – Digital 6
PO1 – Analog A0
SV2 – Digital 7
PO2 – Analog A1
VIN – +5V
GND – GND
DL1912Mk02.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #12: Robotics - Laser Diode - Mk03 // 12-02 // DL1912Mk02p.ino 12-03 // Arduino UNO // Screw Shield // Adafruit RGB LCD Shield // 1 x Small Stepper Motor // 1 x Symbol Stepper Motor // 2 x EasyDriver // 2 x RC Servo Motor // 2 x Potentiometer // 1 x LED Red // 1 x Rocker Switches // 1 x Laser Red // include the library code: #include <Adafruit_RGBLCDShield.h> #include <Servo.h> // Adafruit RGB LCD Shield Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield(); // These #defines make it easy to set the backlight color #define OFF 0x0 #define RED 0x1 #define YELLOW 0x3 #define GREEN 0x2 #define TEAL 0x6 #define BLUE 0x4 #define VIOLET 0x5 #define WHITE 0x7 // Momentary Button int yy = 0; uint8_t momentaryButton = 0; // 2 x EasyDriver int dirPinR = 2; // EasyDriver Right int stepPinR = 3; // stepPin Right int dirPinL = 4; // EasyDriver Left int stepPinL = 5; // stepPin Left int i = 0; // 2 x RC Servo Motor // 2 x Potentiometer Servo isRCServo1; // Create servo object to control a RCServo1 int servo1 = 6; // Servo 1 int iPot1 = A0; // Analog Potentiometer 1 int iVal1; // Variable - Analog Potentiometer 1 Servo isRCServo2; // Create servo object to control a RCServo2 int servo2 = 7; // Servo 2 int iPot2 = A1; // Analog Potentiometer 2 int iVal2; // Variable - Analog Potentiometer 2 void loop() { // Clear RGBLCDShield.clear(); // Momentary Button momentaryButton = RGBLCDShield.readButtons(); switch ( yy ) { case 1: // Up isSwitch1(); break; case 2: // Down isSwitch2(); break; case 3: // Right isSwitch3(); break; case 4: // Left isSwitch4(); break; case 5: // Stop isSwitch5(); break; default: // Stop yy = 5; RGBLCDShield.setBacklight(RED); isSwitch5(); } if ( momentaryButton ) { if ( momentaryButton & BUTTON_UP ) { yy = 1; // Up RGBLCDShield.setBacklight(GREEN); } if ( momentaryButton & BUTTON_DOWN ) { yy = 2; // Down RGBLCDShield.setBacklight(VIOLET); } if ( momentaryButton & BUTTON_LEFT ) { yy = 3; // Right RGBLCDShield.setBacklight(TEAL); } if ( momentaryButton & BUTTON_RIGHT ) { yy = 4; // Left RGBLCDShield.setBacklight(YELLOW); } if ( momentaryButton & BUTTON_SELECT ) { yy = 5; // Stop RGBLCDShield.setBacklight(RED); } } }
getServo.ino
// Servo // isServoSetup void isServoSetup() { // 2 x RC Servo Motor isRCServo1.attach( servo1 ); isRCServo2.attach( servo2 ); } // isServo1 void isServo1() { // EasyDriver isStepperStop(); // Potentiometer RC Servo Motor 1 iVal1 = analogRead( iPot1 ); // Reads the value of the iPot1 (Value between 0 and 1023) iVal1 = map(iVal1, 0, 1023, 0, 180); // Scale it to use it with the isRCServo1 (Value between 0 and 180) isRCServo1.write( iVal1 ); // isRCServo1 sets the servo position according to the scaled value delay(15); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("RC Servo 1"); // RC Servo 1 // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print( iVal1 ); // Reads the value iVal1 delay(500); } // isServo2 void isServo2() { // EasyDriver isStepperStop(); // Potentiometer RC Servo Motor 1 iVal2 = analogRead( iPot2 ); // Reads the value of the iPot2 (Value between 0 and 1023) iVal2 = map(iVal2, 0, 1023, 0, 180); // Scale it to use it with the isRCServo2 (Value between 0 and 180) isRCServo2.write( iVal2 ); // isRCServo2 sets the servo position according to the scaled value delay(15); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("RC Servo 2"); // RC Servo 2 // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print( iVal2 ); // Reads the value iVal2 delay(500); }
getStepper.ino
// Stepper // isStepperSetup void isStepperSetup() { // 2 x EasyDriver pinMode(dirPinR, OUTPUT); pinMode(stepPinR, OUTPUT); pinMode(dirPinL, OUTPUT); pinMode(stepPinL, OUTPUT); } // isStepper1 void isStepper1(){ // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("EasyDriver"); // EasyDriver RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Small Stepper"); // Small Stepper delay(500); // EasyDriver digitalWrite(dirPinR, LOW); // Set the direction. delay(100); for (i = 0; i<300; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(170); // This delay time is close to top speed. } } // isStepper2 void isStepper2(){ // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("EasyDriver"); // EasyDriver RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Symbol Stepper"); // Symbol Stepper delay(500); // EasyDriver digitalWrite(dirPinL, HIGH); // Set the direction. delay(100); for (i = 0; i<300; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(170); // This delay time is close to top speed. } } // isStepperStop void isStepperStop() { // 2 x EasyDriver digitalWrite(dirPinR, LOW); // Set the direction. delay(100); digitalWrite(dirPinL, LOW); // Set the direction. delay(100); digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the }
getSwitch.ino
// Switch // Switch 1 void isSwitch1(){ // Small Stepper yy = 1; // EasyDriver isStepper1(); } // Switch 2 void isSwitch2(){ // Symbol Stepper yy = 2; // EasyDriver isStepper2(); } // Switch 3 void isSwitch3(){ // RC Servo Motor 1 yy = 3; // Potentiometer RC Servo Motor 1 isServo1(); } // Switch 4 void isSwitch4(){ // RC Servo Motor 2 yy = 4; // Potentiometer RC Servo Motor 2 isServo2(); } // Switch 5 void isSwitch5(){ // Stop yy = 5; // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Robotics"); // Robotics RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Stop"); delay( 500 ); // EasyDriver isStepperStop(); }
setup.ino
// Setup void setup() { // Adafruit RGB LCD Shield // Set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); RGBLCDShield.setBacklight(GREEN); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc Electron"); // Don luc Electron // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("Robotics"); // EasyDriver delay(5000); // Clear RGBLCDShield.clear(); // 2 x EasyDriver isStepperSetup(); // 2 x RC Servo Motor isServoSetup(); }
Follow Us
Web: https://www.donluc.com/
Web: http://neosteamlabs.com/
Web: http://www.jlpconsultants.com/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Facebook: https://www.facebook.com/neosteam.labs.9/
Instagram: https://www.instagram.com/neosteamlabs/
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Twitter: https://twitter.com/labs_steam
Etsy: https://www.etsy.com/shop/NeoSteamLabs
Don Luc
Project #12: Robotics – RC Servo Motor – Mk02
——
——
——
——
——
——
——
——
——
Servo (Radio Control)
Servos (also RC servos) are small, cheap, mass-produced servomotors or other actuators used for radio control and small-scale robotics.
Radio control servos are connected through a standard three-wire connection: two wires for a DC power supply and one for control, carrying a pulse-width modulation (PWM) signal. Each servo has a separate connection and PWM signal from the radio control receiver. This signal is easily generated by simple electronics, or by microcontrollers such as the Arduino. This, together with their low-cost, has led to their wide adoption for robotics and physical computing.
DL1912Mk01
1 x Adafruit RGB LCD Shield 16×2 Character Display
1 x Arduino UNO – R3
1 x ProtoScrewShield
2 x EasyDriver – Stepper Motor Driver
2 x Small Stepper Motor
2 x Pololu Mounting
2 x RC Servo Motor
2 x Potentiometer 1M Ohm
2 x Knob
4 x Jumper Wires 3″ M/M
22 x Jumper Wires 6″ M/M
3 x Half-Size Breadboard
Arduino UNO
SP1 – Digital 3
DI1 – Digital 2
SP2 – Digital 5
DI2 – Digital 4
SV1 – Digital 6
PO1 – Analog A0
SV2 – Digital 7
PO2 – Analog A1
VIN – +5V
GND – GND
DL1912Mk01.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #12: Robotics - RC Servo Motor - Mk02 // 12-01 // DL1912Mk01p.ino 12-02 // Arduino UNO // Screw Shield // Adafruit RGB LCD Shield // 2 x Small Stepper Motor // 2 x EasyDriver // 2 x RC Servo Motor // 2 x Potentiometer // include the library code: #include <Adafruit_RGBLCDShield.h> #include <Servo.h> // Adafruit RGB LCD Shield Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield(); // These #defines make it easy to set the backlight color #define OFF 0x0 #define RED 0x1 #define YELLOW 0x3 #define GREEN 0x2 #define TEAL 0x6 #define BLUE 0x4 #define VIOLET 0x5 #define WHITE 0x7 // Momentary Button int yy = 0; uint8_t momentaryButton = 0; // 2 x EasyDriver int dirPinR = 2; // EasyDriver Right int stepPinR = 3; // stepPin Right int dirPinL = 4; // EasyDriver Left int stepPinL = 5; // stepPin Left int i = 0; // 2 x RC Servo Motor // 2 x Potentiometer Servo isRCServo1; // Create servo object to control a RCServo1 int servo1 = 6; // Servo 1 int iPot1 = A0; // Analog Potentiometer 1 int iVal1; // Variable - Analog Potentiometer 1 Servo isRCServo2; // Create servo object to control a RCServo2 int servo2 = 7; // Servo 2 int iPot2 = A1; // Analog Potentiometer 2 int iVal2; // Variable - Analog Potentiometer 2 void loop() { // Clear RGBLCDShield.clear(); // Momentary Button momentaryButton = RGBLCDShield.readButtons(); switch ( yy ) { case 1: // Up isSwitch1(); break; case 2: // Down isSwitch2(); break; case 3: // Right isSwitch3(); break; case 4: // Left isSwitch4(); break; case 5: // Stop isSwitch5(); break; default: // Stop yy = 5; RGBLCDShield.setBacklight(RED); isSwitch5(); } if ( momentaryButton ) { if ( momentaryButton & BUTTON_UP ) { yy = 1; // Up RGBLCDShield.setBacklight(GREEN); } if ( momentaryButton & BUTTON_DOWN ) { yy = 2; // Down RGBLCDShield.setBacklight(VIOLET); } if ( momentaryButton & BUTTON_LEFT ) { yy = 3; // Right RGBLCDShield.setBacklight(TEAL); } if ( momentaryButton & BUTTON_RIGHT ) { yy = 4; // Left RGBLCDShield.setBacklight(YELLOW); } if ( momentaryButton & BUTTON_SELECT ) { yy = 5; // Stop RGBLCDShield.setBacklight(RED); } } }
getServo.ino
// Servo // isServoSetup void isServoSetup() { // 2 x RC Servo Motor isRCServo1.attach( servo1 ); isRCServo2.attach( servo2 ); } // isServo1 void isServo1() { // EasyDriver isStepperStop(); // Potentiometer RC Servo Motor 1 iVal1 = analogRead( iPot1 ); // Reads the value of the iPot1 (Value between 0 and 1023) iVal1 = map(iVal1, 0, 1023, 0, 180); // Scale it to use it with the isRCServo1 (Value between 0 and 180) isRCServo1.write( iVal1 ); // isRCServo1 sets the servo position according to the scaled value delay(15); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("isRCServo 1"); // isRCServo 1 // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print( iVal1 ); // Reads the value iVal1 delay(500); } // isServo2 void isServo2() { // EasyDriver isStepperStop(); // Potentiometer RC Servo Motor 1 iVal2 = analogRead( iPot2 ); // Reads the value of the iPot2 (Value between 0 and 1023) iVal2 = map(iVal2, 0, 1023, 0, 180); // Scale it to use it with the isRCServo2 (Value between 0 and 180) isRCServo2.write( iVal2 ); // isRCServo2 sets the servo position according to the scaled value delay(15); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("isRCServo 2"); // isRCServo 2 // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print( iVal2 ); // Reads the value iVal2 delay(500); }
getStepper.ino
// Stepper // isStepperSetup void isStepperSetup() { // 2 x EasyDriver pinMode(dirPinR, OUTPUT); pinMode(stepPinR, OUTPUT); pinMode(dirPinL, OUTPUT); pinMode(stepPinL, OUTPUT); } // isStepper1 void isStepper1(){ // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("EasyDriver"); // EasyDriver RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Up"); delay(500); // 2 x EasyDriver digitalWrite(dirPinR, LOW); // Set the direction. delay(100); digitalWrite(dirPinL, LOW); // Set the direction. delay(100); for (i = 0; i<300; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(170); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(170); // This delay time is close to top speed. } } // isStepper2 void isStepper2(){ // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("EasyDriver"); // EasyDriver RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Down"); delay(500); // 2 x EasyDriver digitalWrite(dirPinR, HIGH); // Set the direction. delay(100); digitalWrite(dirPinL, HIGH); // Set the direction. delay(100); for (i = 0; i<300; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(170); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(170); // This delay time is close to top speed. } } // isStepperStop void isStepperStop() { // 2 x EasyDriver digitalWrite(dirPinR, LOW); // Set the direction. delay(100); digitalWrite(dirPinL, LOW); // Set the direction. delay(100); digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the }
getSwitch.ino
// Switch // Switch 1 void isSwitch1(){ // Up yy = 1; // 2 x EasyDriver isStepper1(); } // Switch 2 void isSwitch2(){ // Down yy = 2; // 2 x EasyDriver isStepper2(); } // Switch 3 void isSwitch3(){ // Right yy = 3; // Potentiometer RC Servo Motor 1 isServo1(); } // Switch 4 void isSwitch4(){ // Left yy = 4; // Potentiometer RC Servo Motor 2 isServo2(); } // Switch 5 void isSwitch5(){ // Stop yy = 5; // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Robotics"); // Robotics RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Stop"); delay( 500 ); // EasyDriver isStepperStop(); }
setup.ino
// Setup void setup() { // Adafruit RGB LCD Shield // Set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); RGBLCDShield.setBacklight(GREEN); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc Electron"); // Don luc Electron // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("Robotics"); // EasyDriver delay(5000); // Clear RGBLCDShield.clear(); // 2 x EasyDriver isStepperSetup(); // 2 x RC Servo Motor isServoSetup(); }
Follow Us
Web: https://www.donluc.com/
Web: http://neosteamlabs.com/
Web: http://www.jlpconsultants.com/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Facebook: https://www.facebook.com/neosteam.labs.9/
Instagram: https://www.instagram.com/neosteamlabs/
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Twitter: https://twitter.com/labs_steam
Etsy: https://www.etsy.com/shop/NeoSteamLabs
Don Luc
Project #12: Robotics – EasyDriver – Mk01
——
——
——
——
——
——
Small Stepper Motor
Stepper motors are great motors for position control. They can be found in desktop printers, plotters, 3D printers, CNC milling machines, and anything else requiring precise position control. Steppers are a special segment of brushless motors. They are purposely built for high-holding torque. This high-holding torque gives the user the ability to incrementally “step” to the next position. This results in a simple positioning system that doesn’t require an encoder. This makes stepper motor controllers very simple to build and use. These small steppers are a great way to get things moving, especially when positioning and repeatability is a concern. This is a Bipolar motor.
Pros
Excellent position accuracy
High holding torque
High reliability
Most steppers come in standard sizes
Cons
Small step distance limits top speed
It’s possible to “skip” steps with high loads
Draws maximum current constantly
DL1911Mk04
1 x Adafruit RGB LCD Shield 16×2 Character Display
1 x Arduino UNO – R3
1 x ProtoScrewShield
2 x EasyDriver – Stepper Motor Driver
2 x Small Stepper Motor
2 x Pololu Mounting
4 x Jumper Wires 3″ M/M
10 x Jumper Wires 6″ M/M
2 x Half-Size Breadboard
Arduino UNO
SP1 – Digital 3
DI1 – Digital 2
SP2 – Digital 5
DI2 – Digital 4
VIN – +5V
GND – GND
DL1911Mk04.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #12: Robotics - EasyDriver - Mk01 // 11-04 // DL1911Mk04p.ino 12-01 // Arduino UNO // Screw Shield // Adafruit RGB LCD Shield // 2 x Small Stepper Motor // 2 x EasyDriver // include the library code: #include <Adafruit_RGBLCDShield.h> // Adafruit RGB LCD Shield Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield(); // These #defines make it easy to set the backlight color #define OFF 0x0 #define RED 0x1 #define YELLOW 0x3 #define GREEN 0x2 #define TEAL 0x6 #define BLUE 0x4 #define VIOLET 0x5 #define WHITE 0x7 // Momentary Button int yy = 0; uint8_t momentaryButton = 0; // 2 x EasyDriver int dirPinR = 2; // EasyDriver Right int stepPinR = 3; // stepPin Right int dirPinL = 4; // EasyDriver Left int stepPinL = 5; // stepPin Left int i = 0; void loop() { // Clear RGBLCDShield.clear(); // Momentary Button momentaryButton = RGBLCDShield.readButtons(); switch ( yy ) { case 1: // Up isSwitch1(); break; case 2: // Down isSwitch2(); break; case 3: // Right isSwitch3(); break; case 4: // Left isSwitch4(); break; case 5: // Stop isSwitch5(); break; default: // Stop yy = 5; RGBLCDShield.setBacklight(RED); isSwitch5(); } if ( momentaryButton ) { if ( momentaryButton & BUTTON_UP ) { yy = 1; // Up RGBLCDShield.setBacklight(GREEN); } if ( momentaryButton & BUTTON_DOWN ) { yy = 2; // Down RGBLCDShield.setBacklight(VIOLET); } if ( momentaryButton & BUTTON_LEFT ) { yy = 3; // Right RGBLCDShield.setBacklight(TEAL); } if ( momentaryButton & BUTTON_RIGHT ) { yy = 4; // Left RGBLCDShield.setBacklight(YELLOW); } if ( momentaryButton & BUTTON_SELECT ) { yy = 5; // Stop RGBLCDShield.setBacklight(RED); } } }
getSwitch.ino
// Switch // Switch 1 void isSwitch1(){ // Up yy = 1; // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("EasyDriver"); // EasyDriver RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Up"); // 2 x EasyDriver digitalWrite(dirPinR, LOW); // Set the direction. delay(100); digitalWrite(dirPinL, LOW); // Set the direction. delay(100); for (i = 0; i<1000; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(170); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(170); // This delay time is close to top speed. } } // Switch 2 void isSwitch2(){ // Down yy = 2; // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("EasyDriver"); // EasyDriver RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Down"); // 2 x EasyDriver digitalWrite(dirPinR, HIGH); // Set the direction. delay(100); digitalWrite(dirPinL, HIGH); // Set the direction. delay(100); for (i = 0; i<1000; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(170); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(170); // This delay time is close to top speed. } } // Switch 3 void isSwitch3(){ // Right yy = 3; // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("EasyDriver"); // EasyDriver RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Hight"); // 2 x EasyDriver digitalWrite(dirPinR, LOW); // Set the direction. delay(100); digitalWrite(dirPinL, HIGH); // Set the direction. delay(100); for (i = 0; i<1000; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(170); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(170); // This delay time is close to top speed. } } // Switch 4 void isSwitch4(){ // Left yy = 4; // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("EasyDriver"); // EasyDriver RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Left"); // 2 x EasyDriver digitalWrite(dirPinR, HIGH); // Set the direction. delay(100); digitalWrite(dirPinL, LOW); // Set the direction. delay(100); for (i = 0; i<1000; i++) // Iterate for 1000 microsteps. { digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinR, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(170); // This delay time is close to top speed. digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, HIGH); // "Rising Edge" so the easydriver knows to when to step. delayMicroseconds(170); // This delay time is close to top speed. } } // Switch 5 void isSwitch5(){ // Stop yy = 5; // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("EasyDriver"); // EasyDriver RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Stop"); delay( 1000 ); // 2 x EasyDriver digitalWrite(dirPinR, LOW); // Set the direction. delay(100); digitalWrite(dirPinL, LOW); // Set the direction. delay(100); digitalWrite(stepPinR, LOW); // This LOW to HIGH change is what creates the digitalWrite(stepPinL, LOW); // This LOW to HIGH change is what creates the }
setup.ino
// Setup void setup() { // Adafruit RGB LCD Shield // Set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); RGBLCDShield.setBacklight(GREEN); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc Electron"); // Don luc Electron // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("EasyDriver"); // EasyDriver delay(5000); // Clear RGBLCDShield.clear(); // 2 x EasyDriver pinMode(dirPinR, OUTPUT); pinMode(stepPinR, OUTPUT); pinMode(dirPinL, OUTPUT); pinMode(stepPinL, OUTPUT); }
Follow Us
Web: https://www.donluc.com/
Web: http://neosteamlabs.com/
Web: http://www.jlpconsultants.com/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Facebook: https://www.facebook.com/neosteam.labs.9/
Instagram: https://www.instagram.com/neosteamlabs/
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Twitter: https://twitter.com/labs_steam
Etsy: https://www.etsy.com/shop/NeoSteamLabs
Don Luc