标签:arduino
1.每个关节转45,往复循环
#include <ax12.h> void setup() { SetPosition(1,511); //set the position of servo # 1 to '511' SetPosition(2,511); SetPosition(3,511); SetPosition(4,511); SetPosition(5,400); delay(100);//wait for servo to move } void loop() { //increment from 511 to 664 for(int i=511;i<664;i++) { //set the position of servo #1 to the current value of 'i' SetPosition(2,i); SetPosition(3,i); SetPosition(4,i); SetPosition(5,i-111); delay(10);//wait for servo to move } delay(1000);//wait for servo to move //decrement from 664 to 511 for(int i=664;i>511;i--) { //set the position of servo #1 to the current value of 'i' SetPosition(2,i); SetPosition(3,i); SetPosition(4,i); SetPosition(5,i-111); delay(10);//wait for servo to move } delay(1000);//wait for servo to move }
#include <ax12.h> void setup() { SetPosition(1,511); SetPosition(2,511); SetPosition(3,511); SetPosition(4,511); SetPosition(5,400); delay(100); } void loop() { //increment from 0 to 1023 for(int i=511;i<664;i++) { SetPosition(2,i); SetPosition(3,i); SetPosition(4,i); SetPosition(5,i-111); delay(10); } delay(1000); for(int i=664;i>511;i--) { SetPosition(2,i); SetPosition(3,i); SetPosition(4,i); SetPosition(5,i-111); delay(10); } delay(1000); }
开始不知到怎么跳出loop(),只能用这种方法了,不知道有没有什么语句可以直接跳出。
arduino控制dynamixel AX-12A的机械臂每个关节转45度
标签:arduino
原文地址:http://blog.csdn.net/hanshuning/article/details/44814835