(SKU:DRI0027)Digital Servo Shield for Arduino
来自DFRobot Product Wiki
目录 |
产品说明
此板内部集成半双工电路。这意味着你的UART发送线被连接到所有的Cds55系列舵机。因此:
当你通过数据线发送一个命令,所有的舵机都会收到信息。但因为发送的信息中包含指定的舵机ID号,
所以只有ID号匹配的舵机才会处理该信息。
因为舵机可以用串行总线连接在一起,它可以连接至少200个舵机。每个都可以反馈它的位置,转速,转矩,电流,以及温度等。它可以做全角度的旋转,就像齿轮电机一样可以控制速度。此特性使得它可以作为轮式机器人或履带机器人的马达。
应用领域
- 教育机器人
- 机械手
- 类人机器人
- 六足爬行机器人
- 任何其它使用伺服驱动的应用
特性列表
- 微控制器:Atmega8
- 供电:6.5-12V
- 兼容Arduino R3
- SPI接口(使用Ardruino数字口 10,11,12,13)
- 初级用户易于使用
- 为高级应用提供UART接口
- 7个舵机连接通道
- 内置半双工电路
- 板面:镀金
- 尺寸:59x53mm
引脚说明
更多细节
- 供电:6.5~12V电源为舵机和整个系统供电
- UART选择:UART已经被焊锡短路.当你想在ATmega8上使用UART时请移除焊锡。
- ATmega8上的UART:此UART接口用于该扩展板的高级应用。你可以使用FTDI在板子上给ATmega8编程。
- SPI从机选择:默认是数字口10.如果你想使用其它数字口,请移除跳线,并连接ss接头到其它的Arduino数字口。
连接图表
示例代码
/* start code */ /* # This Sample code is for testing the Digital Servo Shield. # Editor : Phoebe # Date : 2013.5.17 # Ver : 0.1 # Product: Digital Servo Shield for Arduino # SKU : # Hardwares: 1. Arduino UNO 2. Digital Servo Shield for Arduino 3. Digital Servos( Compatible with CDS55xx...etc) 4. Power supply:6.5 - 12V */ #include <SPI.h> #include <ServoCds55.h> #include "pins_arduino.h" ServoCds55 myservo; void setup (void) { Serial.begin (115200); digitalWrite(SS, HIGH); SPI.begin (); SPI.setClockDivider(SPI_CLOCK_DIV8); } void loop (void) { if(Serial.available()){ char val = Serial.read(); if(val != -1) { switch(val) { case 'p': myservo.write(1,300);//ID:1 Pos:300 velocity:150 delay(3000); myservo.write(1,0);//ID:1 Pos:0 velocity:150 break; case 'v': myservo.setVelocity(100);// set velocity to 100(range:0-300) in Servo mode break; case 'm': myservo.rotate(1,150);// CCW ID:1 Velocity: 150 middle velocity 300 max delay(2000); myservo.rotate(1,-150);// CW ID:1 Velocity: -150 middle velocity -300 max break; // case 'i': // myservo.SetID(1,2);//ID:1 newID:2 // break; // // case 'r': // myservo.Reset(2);//Restore ID2 servo to factory Settings ( ID:1 Baud rate:1000000) // break; } } else Serial.println("Wait"); delay(500); } } /* end code */