Skip to content

Commit 5ae2091

Browse files
author
Kei
authored
Merge pull request #20 from ROBOTIS-GIT/update_examples
updated examples to reduce RAM usage, changed DEBUG_SERIAL definition.
2 parents c53c88e + 88e5537 commit 5ae2091

File tree

19 files changed

+73
-205
lines changed

19 files changed

+73
-205
lines changed

examples/advanced/bulk_read_write_raw/bulk_read_write_raw.ino

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,16 @@
1616

1717
#include <Dynamixel2Arduino.h>
1818

19-
#ifdef ARDUINO_AVR_UNO
19+
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_MEGA2560)
2020
#include <SoftwareSerial.h>
21-
SoftwareSerial soft_serial(7, 8); //RX,TX
21+
SoftwareSerial soft_serial(7, 8); // DYNAMIXELShield UART RX/TX
2222
#define DXL_SERIAL Serial
2323
#define DEBUG_SERIAL soft_serial
24-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
25-
#elif ARDUINO_AVR_MEGA2560
26-
#define DXL_SERIAL Serial
27-
#define DEBUG_SERIAL Serial1
28-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
29-
#elif BOARD_OpenCM904
30-
#define DXL_SERIAL Serial3 //OpenCM9.04 EXP Board's DXL port Serial. (To use the DXL port on the OpenCM 9.04 board, you must use Serial1 for Serial. And because of the OpenCM 9.04 driver code, you must call Serial1.setDxlMode(true); before dxl.begin();.)
31-
#define DEBUG_SERIAL Serial
32-
const uint8_t DXL_DIR_PIN = 22; //OpenCM9.04 EXP Board's DIR PIN. (To use the DXL port on the OpenCM 9.04 board, you must use 28 for DIR PIN.)
24+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3325
#else
3426
#define DXL_SERIAL Serial1
3527
#define DEBUG_SERIAL Serial
36-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
28+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3729
#endif
3830

3931
/* XelInfoForBulkReadParam_t

examples/advanced/operating_mode_advanced/operating_mode_advanced.ino

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,16 @@
1616

1717
#include <Dynamixel2Arduino.h>
1818

19-
#ifdef ARDUINO_AVR_UNO
19+
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_MEGA2560)
2020
#include <SoftwareSerial.h>
21-
SoftwareSerial soft_serial(7, 8); //RX,TX
21+
SoftwareSerial soft_serial(7, 8); // DYNAMIXELShield UART RX/TX
2222
#define DXL_SERIAL Serial
2323
#define DEBUG_SERIAL soft_serial
24-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
25-
#elif ARDUINO_AVR_MEGA2560
26-
#define DXL_SERIAL Serial
27-
#define DEBUG_SERIAL Serial1
28-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
29-
#elif BOARD_OpenCM904
30-
#define DXL_SERIAL Serial3 //OpenCM9.04 EXP Board's DXL port Serial. (To use the DXL port on the OpenCM 9.04 board, you must use Serial1 for Serial. And because of the OpenCM 9.04 driver code, you must call Serial1.setDxlMode(true); before dxl.begin();.)
31-
#define DEBUG_SERIAL Serial
32-
const uint8_t DXL_DIR_PIN = 22; //OpenCM9.04 EXP Board's DIR PIN. (To use the DXL port on the OpenCM 9.04 board, you must use 28 for DIR PIN.)
24+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3325
#else
3426
#define DXL_SERIAL Serial1
3527
#define DEBUG_SERIAL Serial
36-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
28+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3729
#endif
3830

3931
const uint8_t DXL_ID = 1;

examples/advanced/slave/slave.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
// Please modify it to suit your hardware.
2121
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_MEGA2560)
2222
#include <SoftwareSerial.h>
23-
SoftwareSerial soft_serial(7, 8); //RX,TX //UART Port on DYNAMIXEL Shield
23+
SoftwareSerial soft_serial(7, 8); // DYNAMIXELShield UART RX/TX
2424
#define DXL_SERIAL Serial
2525
#define DEBUG_SERIAL soft_serial
26-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
26+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
2727
#else
2828
#define DXL_SERIAL Serial1
2929
#define DEBUG_SERIAL Serial
30-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
30+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3131
#endif
3232

3333
// Create a port object for DYNAMIXEL communication.

examples/advanced/slave_callback/slave_callback.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
// Please modify it to suit your hardware.
2121
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_MEGA2560)
2222
#include <SoftwareSerial.h>
23-
SoftwareSerial soft_serial(7, 8); //RX,TX //UART Port on DYNAMIXEL Shield
23+
SoftwareSerial soft_serial(7, 8); // DYNAMIXELShield UART RX/TX
2424
#define DXL_SERIAL Serial
2525
#define DEBUG_SERIAL soft_serial
26-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
26+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
2727
#else
2828
#define DXL_SERIAL Serial1
2929
#define DEBUG_SERIAL Serial
30-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
30+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3131
#endif
3232

3333
// Create a port object for DYNAMIXEL communication.

examples/advanced/sync_bulk_raw/sync_bulk_raw.ino

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,16 @@
1616

1717
#include <Dynamixel2Arduino.h>
1818

19-
#ifdef ARDUINO_AVR_UNO
19+
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_MEGA2560)
2020
#include <SoftwareSerial.h>
21-
SoftwareSerial soft_serial(7, 8); //RX,TX
21+
SoftwareSerial soft_serial(7, 8); // DYNAMIXELShield UART RX/TX
2222
#define DXL_SERIAL Serial
2323
#define DEBUG_SERIAL soft_serial
24-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
25-
#elif ARDUINO_AVR_MEGA2560
26-
#define DXL_SERIAL Serial
27-
#define DEBUG_SERIAL Serial1
28-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
29-
#elif BOARD_OpenCM904
30-
#define DXL_SERIAL Serial3 //OpenCM9.04 EXP Board's DXL port Serial. (To use the DXL port on the OpenCM 9.04 board, you must use Serial1 for Serial. And because of the OpenCM 9.04 driver code, you must call Serial1.setDxlMode(true); before dxl.begin();.)
31-
#define DEBUG_SERIAL Serial
32-
const uint8_t DXL_DIR_PIN = 22; //OpenCM9.04 EXP Board's DIR PIN. (To use the DXL port on the OpenCM 9.04 board, you must use 28 for DIR PIN.)
24+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3325
#else
3426
#define DXL_SERIAL Serial1
3527
#define DEBUG_SERIAL Serial
36-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
28+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3729
#endif
3830

3931
/* ParamForSyncReadInst_t

examples/advanced/sync_read_write_raw/sync_read_write_raw.ino

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,16 @@
1616

1717
#include <Dynamixel2Arduino.h>
1818

19-
#ifdef ARDUINO_AVR_UNO
19+
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_MEGA2560)
2020
#include <SoftwareSerial.h>
21-
SoftwareSerial soft_serial(7, 8); //RX,TX
21+
SoftwareSerial soft_serial(7, 8); // DYNAMIXELShield UART RX/TX
2222
#define DXL_SERIAL Serial
2323
#define DEBUG_SERIAL soft_serial
24-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
25-
#elif ARDUINO_AVR_MEGA2560
26-
#define DXL_SERIAL Serial
27-
#define DEBUG_SERIAL Serial1
28-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
29-
#elif BOARD_OpenCM904
30-
#define DXL_SERIAL Serial3 //OpenCM9.04 EXP Board's DXL port Serial. (To use the DXL port on the OpenCM 9.04 board, you must use Serial1 for Serial. And because of the OpenCM 9.04 driver code, you must call Serial1.setDxlMode(true); before dxl.begin();.)
31-
#define DEBUG_SERIAL Serial
32-
const uint8_t DXL_DIR_PIN = 22; //OpenCM9.04 EXP Board's DIR PIN. (To use the DXL port on the OpenCM 9.04 board, you must use 28 for DIR PIN.)
24+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3325
#else
3426
#define DXL_SERIAL Serial1
3527
#define DEBUG_SERIAL Serial
36-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
28+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3729
#endif
3830

3931
/* ParamForSyncReadInst_t

examples/basic/baudrate/baudrate.ino

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,16 @@
1616

1717
#include <Dynamixel2Arduino.h>
1818

19-
#ifdef ARDUINO_AVR_UNO
19+
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_MEGA2560)
2020
#include <SoftwareSerial.h>
21-
SoftwareSerial soft_serial(7, 8); //RX,TX
21+
SoftwareSerial soft_serial(7, 8); // DYNAMIXELShield UART RX/TX
2222
#define DXL_SERIAL Serial
2323
#define DEBUG_SERIAL soft_serial
24-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
25-
#elif ARDUINO_AVR_MEGA2560
26-
#define DXL_SERIAL Serial
27-
#define DEBUG_SERIAL Serial1
28-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
29-
#elif BOARD_OpenCM904
30-
#define DXL_SERIAL Serial3 //OpenCM9.04 EXP Board's DXL port Serial. (To use the DXL port on the OpenCM 9.04 board, you must use Serial1 for Serial. And because of the OpenCM 9.04 driver code, you must call Serial1.setDxlMode(true); before dxl.begin();.)
31-
#define DEBUG_SERIAL Serial
32-
const uint8_t DXL_DIR_PIN = 22; //OpenCM9.04 EXP Board's DIR PIN. (To use the DXL port on the OpenCM 9.04 board, you must use 28 for DIR PIN.)
24+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3325
#else
3426
#define DXL_SERIAL Serial1
3527
#define DEBUG_SERIAL Serial
36-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
28+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3729
#endif
3830

3931
const uint8_t DXL_ID = 1;

examples/basic/current_mode/current_mode.ino

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,16 @@
1616

1717
#include <Dynamixel2Arduino.h>
1818

19-
#ifdef ARDUINO_AVR_UNO
19+
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_MEGA2560)
2020
#include <SoftwareSerial.h>
21-
SoftwareSerial soft_serial(7, 8); //RX,TX
21+
SoftwareSerial soft_serial(7, 8); // DYNAMIXELShield UART RX/TX
2222
#define DXL_SERIAL Serial
2323
#define DEBUG_SERIAL soft_serial
24-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
25-
#elif ARDUINO_AVR_MEGA2560
26-
#define DXL_SERIAL Serial
27-
#define DEBUG_SERIAL Serial1
28-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
29-
#elif BOARD_OpenCM904
30-
#define DXL_SERIAL Serial3 //OpenCM9.04 EXP Board's DXL port Serial. (To use the DXL port on the OpenCM 9.04 board, you must use Serial1 for Serial. And because of the OpenCM 9.04 driver code, you must call Serial1.setDxlMode(true); before dxl.begin();.)
31-
#define DEBUG_SERIAL Serial
32-
const uint8_t DXL_DIR_PIN = 22; //OpenCM9.04 EXP Board's DIR PIN. (To use the DXL port on the OpenCM 9.04 board, you must use 28 for DIR PIN.)
24+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3325
#else
3426
#define DXL_SERIAL Serial1
3527
#define DEBUG_SERIAL Serial
36-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
28+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3729
#endif
3830

3931
const uint8_t DXL_ID = 1;

examples/basic/current_position_mode/current_position_mode.ino

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,16 @@
2020

2121
#include <Dynamixel2Arduino.h>
2222

23-
#ifdef ARDUINO_AVR_UNO
23+
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_MEGA2560)
2424
#include <SoftwareSerial.h>
25-
SoftwareSerial soft_serial(7, 8); //RX,TX
25+
SoftwareSerial soft_serial(7, 8); // DYNAMIXELShield UART RX/TX
2626
#define DXL_SERIAL Serial
2727
#define DEBUG_SERIAL soft_serial
28-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
29-
#elif ARDUINO_AVR_MEGA2560
30-
#define DXL_SERIAL Serial
31-
#define DEBUG_SERIAL Serial1
32-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
33-
#elif BOARD_OpenCM904
34-
#define DXL_SERIAL Serial3 //OpenCM9.04 EXP Board's DXL port Serial. (To use the DXL port on the OpenCM 9.04 board, you must use Serial1 for Serial. And because of the OpenCM 9.04 driver code, you must call Serial1.setDxlMode(true); before dxl.begin();.)
35-
#define DEBUG_SERIAL Serial
36-
const uint8_t DXL_DIR_PIN = 22; //OpenCM9.04 EXP Board's DIR PIN. (To use the DXL port on the OpenCM 9.04 board, you must use 28 for DIR PIN.)
28+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3729
#else
3830
#define DXL_SERIAL Serial1
3931
#define DEBUG_SERIAL Serial
40-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
32+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
4133
#endif
4234

4335
const uint8_t DXL_ID = 1;

examples/basic/id/id.ino

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,16 @@
1616

1717
#include <Dynamixel2Arduino.h>
1818

19-
#ifdef ARDUINO_AVR_UNO
19+
#if defined(ARDUINO_AVR_UNO) || defined(ARDUINO_AVR_MEGA2560)
2020
#include <SoftwareSerial.h>
21-
SoftwareSerial soft_serial(7, 8); //RX,TX
21+
SoftwareSerial soft_serial(7, 8); // DYNAMIXELShield UART RX/TX
2222
#define DXL_SERIAL Serial
2323
#define DEBUG_SERIAL soft_serial
24-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
25-
#elif ARDUINO_AVR_MEGA2560
26-
#define DXL_SERIAL Serial
27-
#define DEBUG_SERIAL Serial1
28-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
29-
#elif BOARD_OpenCM904
30-
#define DXL_SERIAL Serial3 //OpenCM9.04 EXP Board's DXL port Serial. (To use the DXL port on the OpenCM 9.04 board, you must use Serial1 for Serial. And because of the OpenCM 9.04 driver code, you must call Serial1.setDxlMode(true); before dxl.begin();.)
31-
#define DEBUG_SERIAL Serial
32-
const uint8_t DXL_DIR_PIN = 22; //OpenCM9.04 EXP Board's DIR PIN. (To use the DXL port on the OpenCM 9.04 board, you must use 28 for DIR PIN.)
24+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3325
#else
3426
#define DXL_SERIAL Serial1
3527
#define DEBUG_SERIAL Serial
36-
const uint8_t DXL_DIR_PIN = 2; //DYNAMIXEL Shield
28+
const uint8_t DXL_DIR_PIN = 2; // DYNAMIXEL Shield DIR PIN
3729
#endif
3830

3931
const uint8_t DXL_ID = 1;

0 commit comments

Comments
 (0)