Here is the sample name: “a_getModelNumber”
The code (the output follows):
[code]/* Dynamixel Model Scan
Searches through all valid IDs to find all dynamixel devices currently on
the bus, and uses the Model Number to identify the device by name
ported from Dxl_Model_Scan by ROBOTIS CO,.LTD.
/
/ Serial device defines for dxl bus */
#define DXL_BUS_SERIAL1 1 //Dynamixel on Serial1(USART1) <-OpenCM9.04
#define DXL_BUS_SERIAL2 2 //Dynamixel on Serial2(USART2) <-LN101,BT210
#define DXL_BUS_SERIAL3 3 //Dynamixel on Serial3(USART3) <-OpenCM 485EXP
Dynamixel Dxl(DXL_BUS_SERIAL1);
void setup() {
// put your setup code here, to run once:
// Dynamixel 2.0 Baudrate -> 0: 9600, 1: 57600, 2: 115200, 3: 1Mbps
Dxl.begin(3);
pinMode(BOARD_LED_PIN, OUTPUT);
// Waits 5 seconds for you to open the console
//(open too quickly after downloading new code, and you will get errors
delay(5000);
SerialUSB.print(“Send any value to continue…\n”);
while(!SerialUSB.available())
{
delay(1000);
digitalWrite(BOARD_LED_PIN, LOW);
SerialUSB.print(“Send any value to continue…\n”);
delay(1000);
digitalWrite(BOARD_LED_PIN, HIGH);
}
}
int model;
void loop() {
// put your main code here, to run repeatedly:
for (int i=1; i<50; i++){
SerialUSB.print(i);
delay(10);
model = Dxl.getModelNumber(i);
if(model == 12)
SerialUSB.println(": AX-12A");
else if(model == 300)
SerialUSB.println(": AX-12W");
else if(model == 1)
SerialUSB.println(": AX-18A");
else if(model == 29)
SerialUSB.println(": MX-28");
else if(model == 54)
SerialUSB.println(": MX-64");
else if(model == 64)
SerialUSB.println(": MX-106");
else if(model == 350)
SerialUSB.println(": XL-320");
else{
if(model == 65535) model = 0;
SerialUSB.print(": Unknown : ");
SerialUSB.println(model);
}
}
while(1){
digitalWrite(BOARD_LED_PIN, LOW);
delay(100);
digitalWrite(BOARD_LED_PIN, HIGH);
delay(100);
}
}
[/code]
And the output:
Send any value to continue…
1: Unknown : 0
2: Unknown : 0
3: Unknown : 0
4: Unknown : 0
5: Unknown : 0
6: Unknown : 0
7: Unknown : 0
8: Unknown : 0
9: Unknown : 0
10: Unknown : 0
11: Unknown : 0
12: Unknown : 0
13: Unknown : 0
14: Unknown : 0
15: Unknown : 0
16: Unknown : 0
17: Unknown : 0
18: Unknown : 0
19: Unknown : 0
20: Unknown : 0
21: Unknown : 0
22: Unknown : 0
23: Unknown : 0
24: Unknown : 0
25: Unknown : 0
26: Unknown : 0
27: Unknown : 0
28: Unknown : 0
29: Unknown : 0
30: Unknown : 0
31: Unknown : 0
32: Unknown : 0
33: Unknown : 0
34: Unknown : 0
35: Unknown : 0
36: Unknown : 0
37: Unknown : 0
38: Unknown : 0
39: Unknown : 0
40: Unknown : 0
41: Unknown : 0
42: Unknown : 0
43: Unknown : 0
44: Unknown : 0
45: Unknown : 0
46: Unknown : 0
47: Unknown : 0
48: Unknown : 0
49: Unknown : 0