<<前へ
次へ>>
モーション連続再生(exe_mot01.c)
モーション連続再生パソコン側プログラム(マイコン側プログラムはfour_cr.c)
/*
Windows版シリアル送信(exe_mot01.c)
モーション連続再生
三点倒立->裏返し歩行
2003/10/14(Tue)
*/
#include <windows.h>
#include <stdio.h>
#include <ctype.h>
#define MOTOR_NUM 12
#define MOTION_NUM1 14
#define MOTION_NUM2 3
#define MOTION_NUM3 4
#define MOTION_NUM 4
#define MOTION_NUM4 4
#define MOTION_NUM5 4
#define MOTION_NUM6 4
#define MOTION_NUM7 4
#define MOTION_NUM8 4
#define MOTION_NUM9 4
#define MOTION_NUM10 4
#define MOTION_NUM11 12
#define MOTION_NUM12 3
unsigned char rc12[MOTOR_NUM][MOTION_NUM12]=
{{ 80, 80, 90},
{ 30,150,150},
{ 40,120,120},
{179, 90, 90},
{110,150,150},
{110,120,120},
{100, 90, 90},
{150, 30, 30},
{140, 60, 60},
{ 0, 90, 90},
{ 70, 70, 30},
{ 70, 70, 60}};
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
unsigned char inter12[MOTION_NUM12]={ 50, 50, 30};
unsigned char rc11[MOTOR_NUM][MOTION_NUM11]=
{{ 90, 90, 90, 90, 90, 90, 80, 80, 80, 80, 80, 80},
{ 30, 30, 90, 90, 90, 90, 30, 30, 30, 30, 30, 30},
{ 60, 60, 60, 60, 60, 60, 60, 60, 40, 40, 40, 40},
{ 90,179,179, 90, 10, 10, 10, 10, 10, 90,179,179},
{ 30, 0, 0, 0, 0, 30, 30, 30, 10, 10, 80,110},
{ 60, 60, 60, 60, 60,120,120, 60, 60, 60, 60,110},
{ 90, 90, 90, 90, 90, 90,100,100,100,100,100,100},
{150,150, 90, 90, 90, 90,150,150,150,150,150,150},
{120,120,120,120,120,120,120,120,140,140,140,140},
{ 90, 0, 0, 90,170,170,170,170,170, 90, 0, 0},
{150,179,179,179,179,150,150,150,170,170,100, 70},
{120,120,120,120,120, 60, 60,120,120,120,120, 70}};
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
unsigned char inter11[MOTION_NUM11]={15,25, 25, 25, 25, 15, 15, 15, 10, 15, 15,20};
unsigned char rc10[MOTOR_NUM][MOTION_NUM10]=
{
{90,65,90,115},{150,150,90,150},{120,120,120,120},
{90,115,90,65},{90,150,150,150},{120,120,120,120},
{90,65,90,115},{90,30,30,30},{60,60,60,60},
{90,115,90,65},{30,30,90,30},{60,60,60,60}
};
/* 0 1 2 3 */
unsigned char inter10[MOTION_NUM10]={15, 15, 15, 15};
unsigned char rc9[MOTOR_NUM][MOTION_NUM9]=
{
{90,65,90,115},{90,170,170,170},{100,100,100,100},
{90,115,90,65},{170,170,90,170},{100,100,100,100},
{90,65,90,115},{10,10,90,10},{80,80,80,80},
{90,115,90,65},{90,10,10,10},{80,80,80,80}
};
/* 0 1 2 3 */
unsigned char inter9[MOTION_NUM9]={2,2,2,2};
unsigned char rc8[MOTOR_NUM][MOTION_NUM8]=
{
{90,80,90,100},{90,120,120,120},{100,150,150,150},
{90,100,90,80},{120,120,90,120},{150,150,100,150},
{90,80,90,100},{60,60,90,60},{30,30,80,30},
{90,100,90,80},{90,60,60,60},{80,30,30,30}
};
/* 0 1 2 3 */
unsigned char inter8[MOTION_NUM8]={15, 15, 15, 15};
unsigned char rc7[MOTOR_NUM][MOTION_NUM7]=
{
{ 40, 70, 40, 10},{150,150,100,150},{120,120,120,120},
{130,160,130,100},{100,150,150,150},{120,120,120,120},
{130,100,130,160},{ 80, 30, 30, 30},{ 60, 60, 60, 60},
{ 40, 10, 40, 70},{ 30, 30, 80, 30},{ 60, 60, 60, 60}
};
/* 0 1 2 3 */
unsigned char inter7[MOTION_NUM7]={15, 15, 15, 15};
unsigned char rc6[MOTOR_NUM][MOTION_NUM6]=
{
{ 40, 70, 40, 10},{100,150,150,150},{120,120,120,120},
{130,160,130,100},{150,150,100,150},{120,120,120,120},
{130,100,130,160},{ 30, 30, 80, 30},{ 60, 60, 60, 60},
{ 40, 10, 40, 70},{ 80, 30, 30, 30},{ 60, 60, 60, 60}
};
/* 0 1 2 3 */
unsigned char inter6[MOTION_NUM6]={15, 15, 15, 15};
unsigned char rc5[MOTOR_NUM][MOTION_NUM]=
{
{ 70,110,110, 70},{150,150,100,100},{120,120,120,120},
{110, 70, 70,110},{100,100,150,150},{120,120,120,120},
{110, 70, 70,110},{ 60, 60, 10, 10},{ 60, 60, 60, 60},
{ 70,110,110, 70},{ 10, 10, 60, 60},{ 60, 60, 60, 60}
};
/* 0 1 2 3 */
unsigned char inter5[MOTION_NUM]={15, 15, 15, 15};
unsigned char rc4[MOTOR_NUM][MOTION_NUM]=
{
{ 70,110,110, 70},{100,100,150,150},{120,120,120,120},
{110, 70, 70,110},{150,150,100,100},{120,120,120,120},
{110, 70, 70,110},{ 10, 10, 60, 60},{ 60, 60, 60, 60},
{ 70,110,110, 70},{ 60, 60, 10, 10},{ 60, 60, 60, 60}
};
/* 0 1 2 3 */
unsigned char inter4[MOTION_NUM]={15, 15, 15, 15};
unsigned char rc[MOTOR_NUM][MOTION_NUM]=
{
{90,65,90,115},{90,150,150,150},{120,120,120,120},
{90,115,90,65},{150,150,90,150},{120,120,120,120},
{90,65,90,115},{30,30,90,30},{60,60,60,60},
{90,115,90,65},{90,30,30,30},{60,60,60,60}
};
/* 0 1 2 3 */
unsigned char inter[MOTION_NUM]={15, 15, 15, 15};
unsigned char rc3[MOTOR_NUM][MOTION_NUM3]=
{
{90,65,90,115},{90,30,30,30},{60,60,60,60},
{90,115,90,65},{30,30,90,30},{60,60,60,60},
{90,65,90,115},{150,150,90,150},{120,120,120,120},
{90,115,90,65},{90,150,150,150},{120,120,120,120}
};
/* 0 1 2 3 */
unsigned char inter3[MOTION_NUM3]={15, 15, 15, 15};
unsigned char rc1[MOTOR_NUM][MOTION_NUM1]=
{{ 90, 90, 90, 90, 90, 90,100,100,100,100,100,100,100, 80},
{150,150, 90, 90, 90, 90,150,150,150,150,150,150,150,150},
{100,100,100,100,100,100,120,120,120,120,120,120,120,120},
{179,179,179, 90, 0, 0, 0, 0, 0, 0, 0, 90,179,179},
{150,179,179,179,179,179,179,150,150,150,170,170, 80, 70},
{100,100,100,100,100, 0, 0, 0,100,100,100,100,100,100},
{ 90, 90, 90, 90, 90, 90, 80, 80, 80, 80, 80, 80, 80,100},
{ 30, 30, 90, 90, 90, 90, 30, 30, 30, 30, 30, 30, 30, 30},
{ 80, 80, 80, 80, 80, 80, 50, 50, 50, 50, 50, 50, 50, 50},
{ 0, 0, 0, 90,179,179,179,179,179,179,179, 90, 0, 0},
{ 30, 0, 0, 0, 0, 0, 0, 30, 30, 30, 10, 10,100,110},
{ 80, 80, 80, 80, 80,179,179,179, 80, 80, 80, 80, 80, 80}};
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
unsigned char rc2[MOTOR_NUM][MOTION_NUM2]=
{{ 80, 80, 90},
{150,150, 30},
{120,120, 60},
{179, 90, 90},
{ 70, 30, 30},
{100, 60, 60},
{100,100, 90},
{ 30, 30,150},
{ 50, 50,120},
{ 0, 90, 90},
{110,150,150},
{ 80,120,120}};
/* 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 */
unsigned char inter1[MOTION_NUM1]={15,25, 25, 25, 25, 5, 5, 5, 10, 15, 15, 15, 30, 10};
unsigned char inter2[MOTION_NUM2]={ 50, 50, 30};
unsigned char tmp;
typedef enum { // ボーレート設定リスト
br2400 = 2400,
br4800 = 4800,
br9600 = 9600,
br19200 = 19200,
br31250 = 31250,
br38400 = 38400,
br57600 = 57600
} BaudRate;
/* シリアルポート初期化関数 */
void InitSer(DCB dcb, HANDLE* hComm, BaudRate baud)
{
*hComm = CreateFile(
"COM1", /* シリアルポートの指定 */
GENERIC_WRITE, /* アクセスモード */
0, /* 共有モード */
NULL, /* セキュリティ属性 */
OPEN_EXISTING, /* 作成フラグ */
FILE_ATTRIBUTE_NORMAL, /* 属性 */
NULL /* テンプレートのハンドル */
);
GetCommState(*hComm, &dcb); /* DCB を取得 */
dcb.BaudRate = baud;
dcb.ByteSize = 8;
dcb.Parity = NOPARITY;
dcb.StopBits = ONESTOPBIT;
SetCommState(*hComm, &dcb); /* DCB を設定 */
}
int chop(char* input)
{
int i, c_stat, r_stat=1;
for(i=0; input[i]!='\n'; i++){
c_stat=isdigit(input[i]);
if(c_stat==0){
r_stat=-1;
}
}
input[i]='\0';
return(r_stat);
}
int checkn(int maxn)
{
char input[1024]; /* 入力用 */
int status, status2, value=-1; /* エラー処理,数値格納 */
while(1){
printf("\n送信数値を入力(0-%d)%dで終了:", maxn,maxn+1);
fgets(input, 1024, stdin);
status=sscanf(input, "%d", &value);
status2=chop(input);
if(status!=1 || status2<0){
printf("数値以外が入力されました\n");
printf("入力文字%s\n", input);
}else if(value>=0 && value <=maxn+1){
if(value==maxn+1){
return(-1);
}
return(value);
}else if(status==1){
printf("0-%dの範囲外の数値が入力されました\n",maxn);
printf("入力数値%d\n", value);
}
value=-1;
}
}
int main(void)
{
DCB dcb; /* 通信パラメータ */
HANDLE hComm; /* シリアルポートのハンドル */
DWORD writesize; /* ポートへ書き込んだバイト数 */
BaudRate baud=br38400; /* BaudRate設定用 */
unsigned char sendd1,sendd2; /* 数値格納 */
int echeck1,echeck2;
InitSer(dcb, &hComm, baud);
/* ---------------------- 通常歩行 ---------------------------------*/
sendd1=252;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=MOTION_NUM;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=4;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
for(echeck1=0; echeck1<MOTOR_NUM; echeck1++){
for(echeck2=0; echeck2<MOTION_NUM; echeck2++){
WriteFile(hComm, &rc[echeck1][echeck2], 1, &writesize, NULL); /* シリアルポートに書き込み */
}
}
sendd1=247;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
for(echeck1=0; echeck1<MOTION_NUM; echeck1++){
WriteFile(hComm, &inter[echeck1], 1, &writesize, NULL);
}
sendd1=1;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=251;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
checkn(253);
/* ---------------------- 旋回反時計回り ---------------------------------*/
sendd1=252;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=MOTION_NUM4;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=4;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
for(echeck1=0; echeck1<MOTOR_NUM; echeck1++){
for(echeck2=0; echeck2<MOTION_NUM4; echeck2++){
WriteFile(hComm, &rc4[echeck1][echeck2], 1, &writesize, NULL); /* シリアルポートに書き込み */
}
}
sendd1=247;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
for(echeck1=0; echeck1<MOTION_NUM4; echeck1++){
WriteFile(hComm, &inter4[echeck1], 1, &writesize, NULL);
}
sendd1=1;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=251;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
checkn(253);
/* ---------------------- 旋回時計回り ---------------------------------*/
sendd1=252;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=MOTION_NUM5;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=4;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
for(echeck1=0; echeck1<MOTOR_NUM; echeck1++){
for(echeck2=0; echeck2<MOTION_NUM5; echeck2++){
WriteFile(hComm, &rc5[echeck1][echeck2], 1, &writesize, NULL); /* シリアルポートに書き込み */
}
}
sendd1=247;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
for(echeck1=0; echeck1<MOTION_NUM5; echeck1++){
WriteFile(hComm, &inter5[echeck1], 1, &writesize, NULL);
}
sendd1=1;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=251;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
checkn(253);
/* ---------------------- 横歩き左方向 ---------------------------------*/
sendd1=252;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=MOTION_NUM6;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=4;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
for(echeck1=0; echeck1<MOTOR_NUM; echeck1++){
for(echeck2=0; echeck2<MOTION_NUM6; echeck2++){
WriteFile(hComm, &rc6[echeck1][echeck2], 1, &writesize, NULL); /* シリアルポートに書き込み */
}
}
sendd1=247;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
for(echeck1=0; echeck1<MOTION_NUM6; echeck1++){
WriteFile(hComm, &inter6[echeck1], 1, &writesize, NULL);
}
sendd1=1;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=251;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
checkn(253);
/* ---------------------- 横歩き右方向 ---------------------------------*/
sendd1=252;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=MOTION_NUM7;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=4;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
for(echeck1=0; echeck1<MOTOR_NUM; echeck1++){
for(echeck2=0; echeck2<MOTION_NUM7; echeck2++){
WriteFile(hComm, &rc7[echeck1][echeck2], 1, &writesize, NULL); /* シリアルポートに書き込み */
}
}
sendd1=247;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
for(echeck1=0; echeck1<MOTION_NUM7; echeck1++){
WriteFile(hComm, &inter7[echeck1], 1, &writesize, NULL);
}
sendd1=1;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=251;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
checkn(253);
/* ---------------------- 低姿勢歩行 ---------------------------------*/
sendd1=252;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=MOTION_NUM8;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=4;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
for(echeck1=0; echeck1<MOTOR_NUM; echeck1++){
for(echeck2=0; echeck2<MOTION_NUM8; echeck2++){
WriteFile(hComm, &rc8[echeck1][echeck2], 1, &writesize, NULL); /* シリアルポートに書き込み */
}
}
sendd1=247;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
for(echeck1=0; echeck1<MOTION_NUM8; echeck1++){
WriteFile(hComm, &inter8[echeck1], 1, &writesize, NULL);
}
sendd1=1;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=251;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
checkn(253);
/* ---------------------- 通常歩行後退 ---------------------------------*/
sendd1=252;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=MOTION_NUM10;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=4;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
for(echeck1=0; echeck1<MOTOR_NUM; echeck1++){
for(echeck2=0; echeck2<MOTION_NUM10; echeck2++){
WriteFile(hComm, &rc10[echeck1][echeck2], 1, &writesize, NULL); /* シリアルポートに書き込み */
}
}
sendd1=247;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
for(echeck1=0; echeck1<MOTION_NUM10; echeck1++){
WriteFile(hComm, &inter10[echeck1], 1, &writesize, NULL);
}
sendd1=1;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=251;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
checkn(253);
/* ---------------------- 高速歩行 ---------------------------------*/
sendd1=252;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
sendd1=MOTION_NUM;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
sendd1=8;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
for(echeck1=0; echeck1<MOTOR_NUM; echeck1++){
for(echeck2=0; echeck2<MOTION_NUM; echeck2++){
WriteFile(hComm, &rc[echeck1][echeck2], 1, &writesize, NULL);
}
}
sendd1=247;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
for(echeck1=0; echeck1<MOTION_NUM
; echeck1++){
WriteFile(hComm, &inter9[echeck1], 1, &writesize, NULL);
}
sendd1=1;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
sendd1=251;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
checkn(253);
/* ---------------------- 三点倒立 ---------------------------------*/
sendd1=252;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=MOTION_NUM1;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=1;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
for(echeck1=0; echeck1<MOTOR_NUM; echeck1++){
for(echeck2=0; echeck2<MOTION_NUM1; echeck2++){
WriteFile(hComm, &rc1[echeck1][echeck2], 1, &writesize, NULL); /* シリアルポートに書き込み */
}
}
sendd1=247;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
for(echeck1=0; echeck1<MOTION_NUM1; echeck1++){
WriteFile(hComm, &inter1[echeck1], 1, &writesize, NULL);
}
sendd1=0;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=251;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
checkn(253);
/* ---------------------- 背面直立 ---------------------------------*/
sendd1=252;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=MOTION_NUM2;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=1;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
for(echeck1=0; echeck1<MOTOR_NUM; echeck1++){
for(echeck2=0; echeck2<MOTION_NUM2; echeck2++){
WriteFile(hComm, &rc2[echeck1][echeck2], 1, &writesize, NULL); /* シリアルポートに書き込み */
}
}
sendd1=247;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
for(echeck1=0; echeck1<MOTION_NUM2; echeck1++){
WriteFile(hComm, &inter2[echeck1], 1, &writesize, NULL);
}
sendd1=251;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
checkn(253);
/* ---------------------- 背面歩行 ---------------------------------*/
sendd1=252;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=MOTION_NUM3;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=3;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
for(echeck1=0; echeck1<MOTOR_NUM; echeck1++){
for(echeck2=0; echeck2<MOTION_NUM3; echeck2++){
WriteFile(hComm, &rc3[echeck1][echeck2], 1, &writesize, NULL); /* シリアルポートに書き込み */
}
}
sendd1=247;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
for(echeck1=0; echeck1<MOTION_NUM3; echeck1++){
WriteFile(hComm, &inter3[echeck1], 1, &writesize, NULL);
}
sendd1=251;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
checkn(253);
/* ---------------------- 背面からの三点倒立 ---------------------------------*/
sendd1=252;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=MOTION_NUM11;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=1;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
for(echeck1=0; echeck1<MOTOR_NUM; echeck1++){
for(echeck2=0; echeck2<MOTION_NUM11; echeck2++){
WriteFile(hComm, &rc11[echeck1][echeck2], 1, &writesize, NULL); /* シリアルポートに書き込み */
}
}
sendd1=247;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
for(echeck1=0; echeck1<MOTION_NUM11; echeck1++){
WriteFile(hComm, &inter11[echeck1], 1, &writesize, NULL);
}
sendd1=0;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=251;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
checkn(253);
/* ---------------------- 直立 ---------------------------------*/
sendd1=252;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=MOTION_NUM12;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
sendd1=1;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
for(echeck1=0; echeck1<MOTOR_NUM; echeck1++){
for(echeck2=0; echeck2<MOTION_NUM12; echeck2++){
WriteFile(hComm, &rc12[echeck1][echeck2], 1, &writesize, NULL); /* シリアルポートに書き込み */
}
}
sendd1=247;
WriteFile(hComm, &sendd1, 1, &writesize, NULL);
for(echeck1=0; echeck1<MOTION_NUM12; echeck1++){
WriteFile(hComm, &inter12[echeck1], 1, &writesize, NULL);
}
sendd1=251;
WriteFile(hComm, &sendd1, 1, &writesize, NULL); /* シリアルポートに書き込み */
CloseHandle(hComm);
return(0);
}
モーション連続再生