here is my code
#include <math.h>
#define Header 0xff
byte *PosPtr;
byte ZeroPosArray[12]={/* ID 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9, 10 , 11 */
132 , 122, 187, 164, 60, 121, 123, 127, 63 , 86 , 195, 127 //initial positions
};
byte WalkPosArray[11][12]={/* ID 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9, 10 , 11 */
{132 , 116, 188, 161, 58 , 119, 123, 121, 62, 89, 197 , 121},//ViaPoint_0
{132 , 115, 166, 190, 64 , 118, 123, 121, 62, 89, 197 , 109},//ViaPoint_1
{132 , 116, 182, 154, 45 , 119, 123, 121, 53, 92, 191 , 121},//ViaPoint_2
{132 , 122, 180, 157, 46 , 125, 123, 127, 55, 89, 190 , 127},//ViaPoint_3
{132 , 129, 183, 158, 50 , 132, 123, 134, 48, 96, 190 , 134},//ViaPoint_4
{132 , 129, 188, 161, 58 , 132, 123, 134, 41, 103, 190 , 134},//ViaPoint_5
{132 , 129, 180, 161, 58 , 142, 123, 135, 84, 60, 191 , 135},//ViaPoint_6
{132 , 129, 197, 158, 64 , 132, 123, 134, 68, 96, 210 , 134},//ViaPoint_7
{132 , 122, 195, 161, 65 , 125, 123, 127, 70, 93, 209 , 125},//ViaPoint_8
{132 , 116, 202, 154, 65 , 119, 123, 121, 58, 90, 194 , 118},//ViaPoint_9
/* {132 , 116, 209, 147, 65 , 114, 123, 121, 68, 96, 210 , 116},//ViaPoint_10 */
{132 , 115, 166, 190, 64 , 118, 123, 121, 62, 89, 197 , 109},//ViaPoint_10
};
void setup()
{
byte i,b;
Serial.begin(115200);
byte LastID, Torque;
LastID=11;
Torque=0; //0(max)~4(min)
stop_Post(LastID,Torque);
b=availableMemory();
Serial.println(b,DEC);
delay(1500);
for(i=0;i<1;i++)
{
motionA(LastID,Torque);
}
stop_Post(LastID,Torque);
}
void loop()
{
}
void SyncPosSend(byte LastID, byte Torque ,byte *PosPtr)
{
byte i, Checksum;
i=0;
Checksum=0;
Serial.print(Header,BYTE);
Serial.print((Torque<<5)|0x1f,BYTE);
Serial.print(LastID+1,BYTE);
for(i=0; i<=LastID; i++)
{
Serial.print(*(PosPtr+i),BYTE);
Checksum ^=*(PosPtr+i);
}
Checksum &=0x7f;
Serial.print(Checksum,BYTE);
}
void motionA(byte LastID, byte Torque)
{
byte ViaPoint;
ViaPoint=0;
for (ViaPoint = 0; ViaPoint <= 10; ViaPoint++)
{
PosPtr=&WalkPosArray[ViaPoint][0];
SyncPosSend(LastID,Torque,PosPtr);
//Serial.println();
delay(650);
}
}
void stop_Post(byte LastID, byte Torque)
{
PosPtr=ZeroPosArray;
SyncPosSend(LastID,Torque,PosPtr);//initialise
}
i really need helps!!!!!!!!!