by blues » Thu Nov 04, 2010 4:25 pm
by blues
Thu Nov 04, 2010 4:25 pm
//max odleglosc sensora IR;
HANDLE hThread_networking;
DWORD threadId_networking;
HANDLE hCom;
char sts[128];
void Servo_readposition(int servo);
void Servo_syncmove(int ptp,int firstservo,int lastservo,int value);
void SerialPutc(HANDLE hCom, char txchar);
int SerialGetc(HANDLE hCom);
int IR_getdata();
float IR_centimeter(int wartosc);
void Servo_enable(int which);
void Servo_move(int which,int position);
void Servo_setspeed(int speed);
void AD_getdata(int port);
void Servo_readgroup6A();
void Servo_readgroup6B();
void Servo_readgroup6C();
void Servo_readgroup6D();
int Memory_read(int low,int high);
DWORD WINAPI THREAD_listenpackets(void *parm);
void Servo_wait(int ktore,int wartosc){
int a=0;
while(ROBONOVA.servo[ktore].value!=wartosc){
if(GetTickCount()-tick>10){
a=Memory_read(32+ktore,0x03);
ROBONOVA.servo[ktore].value=a;
tick=GetTickCount();
}
}
}
float Voltage(){
int value;
AD_getdata(5);
return (10*ROBONOVA.sensor[5].value)/256;
}
int Memory_read(int low,int high){
int a;
SerialPutc(hCom,0xF7);SerialGetc(hCom);
SerialPutc(hCom,low);SerialGetc(hCom);
SerialPutc(hCom,high);SerialGetc(hCom);
SerialPutc(hCom,0x00);a=SerialGetc(hCom);
return a;
}
void Reboot(){
int A,a,b,c,d;
SerialPutc(hCom,0xAF); A=SerialGetc(hCom);
SerialPutc(hCom,0x62); a=SerialGetc(hCom);
SerialPutc(hCom,0x6F); b=SerialGetc(hCom);
SerialPutc(hCom,0x6F); c=SerialGetc(hCom);
SerialPutc(hCom,0x74); d=SerialGetc(hCom);
if(a==0x42 && b==0x4f && c==0x4f && d==0x54){SetStatusText("Boot sequence OK");ROBONOVA.bootsequence=1;}
else{
sprintf(sts,"[0%x] Boot sequence strange: %x %x %x %x - RESTARTING",A,a,b,c,d);
SetStatusText(sts);
Reboot();
}
}
void Servo_move(int which,int position){
SerialPutc(hCom,0xE6);SerialGetc(hCom); //move servo
SerialPutc(hCom,which);SerialGetc(hCom); //ktore serwo
SerialPutc(hCom,position);SerialGetc(hCom); //position
}
void MOVEG6A(int a, int b, int c, int d,int e,int f){
SerialPutc(hCom,0xEB);SerialGetc(hCom);//SYNC MOVE
SerialPutc(hCom,0);SerialGetc(hCom);
SerialPutc(hCom,6);SerialGetc(hCom);
SerialPutc(hCom,a);SerialGetc(hCom);
SerialPutc(hCom,b);SerialGetc(hCom);
SerialPutc(hCom,c);SerialGetc(hCom);
SerialPutc(hCom,d);SerialGetc(hCom);
SerialPutc(hCom,e);SerialGetc(hCom);
SerialPutc(hCom,f);SerialGetc(hCom);
}
void MOVEG6B(int a, int b, int c, int d,int e, int f){
SerialPutc(hCom,0xEB);SerialGetc(hCom);//SYNC MOVE
SerialPutc(hCom,6);SerialGetc(hCom);
SerialPutc(hCom,6);SerialGetc(hCom);
//
SerialPutc(hCom,a);SerialGetc(hCom);
SerialPutc(hCom,b);SerialGetc(hCom);
SerialPutc(hCom,c);SerialGetc(hCom);
SerialPutc(hCom,d);SerialGetc(hCom);
SerialPutc(hCom,e);SerialGetc(hCom);
SerialPutc(hCom,f);SerialGetc(hCom);
}
void MOVEG6C(int a, int b, int c, int d,int e, int f){
SerialPutc(hCom,0xEB);SerialGetc(hCom);//SYNC MOVE
SerialPutc(hCom,12);SerialGetc(hCom);
SerialPutc(hCom,6);SerialGetc(hCom);
//
SerialPutc(hCom,a);SerialGetc(hCom);
SerialPutc(hCom,b);SerialGetc(hCom);
SerialPutc(hCom,c);SerialGetc(hCom);
SerialPutc(hCom,d);SerialGetc(hCom);
SerialPutc(hCom,0);SerialGetc(hCom); //servo IR
SerialPutc(hCom,f);SerialGetc(hCom);
}
void MOVEG6D(int a, int b, int c, int d,int e, int f){
SerialPutc(hCom,0xEB);SerialGetc(hCom);//SYNC MOVE
SerialPutc(hCom,18);SerialGetc(hCom);
SerialPutc(hCom,6);SerialGetc(hCom);
//
SerialPutc(hCom,a);SerialGetc(hCom);
SerialPutc(hCom,b);SerialGetc(hCom);
SerialPutc(hCom,c);SerialGetc(hCom);
SerialPutc(hCom,d);SerialGetc(hCom);
SerialPutc(hCom,e);SerialGetc(hCom);
SerialPutc(hCom,f);SerialGetc(hCom);
}
void MOVE24(int a, int b, int c, int d, int e ,int f, int g, int h, int i, int j , int k, int l,int m, int n,int o, int p, int q, int r, int s,int t, int u, int v, int w, int x){
SerialPutc(hCom,0xEB);SerialGetc(hCom);//SYNC MOVE
SerialPutc(hCom,0);SerialGetc(hCom);
SerialPutc(hCom,24);SerialGetc(hCom);
//Off we go.
SerialPutc(hCom,a);SerialGetc(hCom);
SerialPutc(hCom,b);SerialGetc(hCom);
SerialPutc(hCom,c);SerialGetc(hCom);
SerialPutc(hCom,d);SerialGetc(hCom);
SerialPutc(hCom,e);SerialGetc(hCom);
SerialPutc(hCom,f);SerialGetc(hCom);
SerialPutc(hCom,g);SerialGetc(hCom);
SerialPutc(hCom,h);SerialGetc(hCom);
SerialPutc(hCom,i);SerialGetc(hCom);
SerialPutc(hCom,j);SerialGetc(hCom);
SerialPutc(hCom,k);SerialGetc(hCom);
SerialPutc(hCom,0);SerialGetc(hCom); //servo iR
SerialPutc(hCom,m);SerialGetc(hCom);
SerialPutc(hCom,n);SerialGetc(hCom);
SerialPutc(hCom,o);SerialGetc(hCom);
SerialPutc(hCom,p);SerialGetc(hCom);
SerialPutc(hCom,q);SerialGetc(hCom);
SerialPutc(hCom,r);SerialGetc(hCom);
SerialPutc(hCom,s);SerialGetc(hCom);
SerialPutc(hCom,t);SerialGetc(hCom);
SerialPutc(hCom,u);SerialGetc(hCom);
SerialPutc(hCom,v);SerialGetc(hCom);
SerialPutc(hCom,w);SerialGetc(hCom);
SerialPutc(hCom,x);SerialGetc(hCom);
}
void SYNCMOVE(){
int A,a,b,c,d,e;
SerialPutc(hCom,0xEB);SerialGetc(hCom);//sync move
SerialPutc(hCom,0x06);SerialGetc(hCom);// start from servo no
SerialPutc(hCom,0x02);SerialGetc(hCom);// how many servoes ?
SerialPutc(hCom,0x64);SerialGetc(hCom);// servo1 pos
SerialPutc(hCom,0x64);SerialGetc(hCom);// servox pos
sprintf(sts,"WRONG %x %x %x %x %x",A,b,c,d,e);SetStatusText(sts);
}
void Servo_enable(int which){
SerialPutc(hCom,0xE7);// turn on the servo
SerialPutc(hCom,which);//ktore serwo
}
void AD_getdata(int port){
int b=0;
SerialPutc(hCom,0xE2); //Get data from AD
SerialGetc(hCom);
SerialPutc(hCom,port); //Pobieramy wartosc z AD.port
SerialGetc(hCom);
SerialPutc(hCom,0x00); //NULL
b=SerialGetc(hCom);
ROBONOVA.sensor[port].value=b;
}
void Servo_setspeed(int speed){
SerialPutc(hCom,0xE9);SerialGetc(hCom);//funkcja predkosc serwa
SerialPutc(hCom,speed);SerialGetc(hCom);//predkosc
}
//Konwertuje wartosc z czujnika na centymetry.
float IR_centimeter(int wartosc){
float oblicz=0;
if(wartosc>0){
oblicz=(1285/wartosc)*1.1060;
return oblicz;}else return 0;
}
int COM_open(){
DCB dcb;
BOOL fSuccess;
char *pcCommPort = "COM1";
hCom = CreateFile( pcCommPort,
GENERIC_READ | GENERIC_WRITE,
0, // must be opened with exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // must use OPEN_EXISTING
0, // not overlapped I/O
NULL // hTemplate must be NULL for comm devices
);
if (hCom == INVALID_HANDLE_VALUE)
{
// Handle the error.
printf ("CreateFile failed with error %d.\n", GetLastError());
return (1);
}
// Build on the current configuration, and skip setting the size
// of the input and output buffers with SetupComm.
fSuccess = GetCommState(hCom, &dcb);
if (!fSuccess)
{
// Handle the error.
printf ("GetCommState failed with error %d.\n", GetLastError());
return (2);
}
// Fill in DCB: 57,600 bps, 8 data bits, no parity, and 1 stop bit.
dcb.BaudRate = CBR_9600; // set the baud rate
dcb.ByteSize = 8; // data size, xmit, and rcv
dcb.Parity = NOPARITY; // no parity bit
dcb.StopBits = ONESTOPBIT; // one stop bit
fSuccess = SetCommState(hCom, &dcb);
if (!fSuccess)
{
// Handle the error.
MessageBox(0,"ERROR COM","",MB_OK);
return (3);
}
// hThread_networking = CreateThread( NULL, 0, THREAD_listenpackets, NULL, 0, &threadId_networking );
return (0);
}
int SerialGetc(HANDLE hCom)
{
char rxchar=0;
BOOL bReadRC;
char z[10];
static DWORD iBytesRead=NULL;;
memset(z,0,sizeof(z));
bReadRC = ReadFile(hCom, &rxchar, 1, &iBytesRead, NULL);
if(bReadRC!=TRUE || iBytesRead<1){
Sleep(1);
SerialGetc(hCom);
}else{
sprintf(z,"%i",rxchar);
return atoi(z);
}
}
void SerialPutc(HANDLE hCom, char txchar)
{
BOOL bWriteRC;
static DWORD iBytesWritten;
bWriteRC = WriteFile(hCom, &txchar, 1, &iBytesWritten,NULL);
if(bWriteRC!=TRUE || iBytesWritten<1>=320 ){
sprintf(sts,"%x%x = %i ",b,a,c);
SetStatusText(sts);
ROBONOVA.servo[wartosc-320].value=c;
}
/*
To keep you going:
The desired positions are stored in 24 memory locations from &H300.
The current positions are stored in 24 memory locations from &H320
They can both be PEEKed there.
When a move is started a bit is cleared in locations &H4E3, &H4E4, &H4E5.
there is one bit per servo starting at bit 0 in &H4E3.
When the current = the desired, then the corresponding bit is set.
A move is complete when all 3 bytes = &HFF
*/
// sprintf(PROCESSOR_status,"Memory red: 0x%x [%x,%x value: %i]",a,SerialGetc(hCom),SerialGetc(hCom),SerialGetc(hCom) );
break;
case 0xffffffd2:
a=0;b=0;c=0;d=0;
a=SerialGetc(hCom);
b=SerialGetc(hCom);
ROBONOVA.servo[a].value=b;
sprintf(GL_status,"%i=%i",a,b);
break;
case 0xffffffe2:
a=0;b=0;c=0;d=0;
a=SerialGetc(hCom);
b=SerialGetc(hCom);
sprintf(sts,"[0x%x] Data read from AD.%i, value=%i\n",A,a,b);
SetStatusText(sts);
ROBONOVA.sensor[a].value=b;
break;
case 0xffffffe9:
a=0;b=0;c=0;d=0;
a=SerialGetc(hCom);
sprintf(sts,"[0x%x] Servo speed to %x",A,a);
SetStatusText(sts);
break;
case 0xffffffe6:
a=0;b=0;c=0;d=0;
a=SerialGetc(hCom);
b=SerialGetc(hCom);
sprintf(sts,"[0x%x] Servo: %i to position %i",A,a,b);
SetStatusText(sts);
break;
case 0xffffffe7:
a=0;b=0;c=0;d=0;
a=SerialGetc(hCom);
b=SerialGetc(hCom);
sprintf(sts,"[0x%x] Servo: %i Enabled. %x",A,a,b);
SetStatusText(sts);
ROBONOVA.servo[a].enabled=1;
break;
}
}
return 0;
}
Hi,
I could read that this code is for comunicate with a Robonova with C++
but I could see that are not include the library, could you write wich librarys need you?
Thank you so much.
//max odleglosc sensora IR;
HANDLE hThread_networking;
DWORD threadId_networking;
HANDLE hCom;
char sts[128];
void Servo_readposition(int servo);
void Servo_syncmove(int ptp,int firstservo,int lastservo,int value);
void SerialPutc(HANDLE hCom, char txchar);
int SerialGetc(HANDLE hCom);
int IR_getdata();
float IR_centimeter(int wartosc);
void Servo_enable(int which);
void Servo_move(int which,int position);
void Servo_setspeed(int speed);
void AD_getdata(int port);
void Servo_readgroup6A();
void Servo_readgroup6B();
void Servo_readgroup6C();
void Servo_readgroup6D();
int Memory_read(int low,int high);
DWORD WINAPI THREAD_listenpackets(void *parm);
void Servo_wait(int ktore,int wartosc){
int a=0;
while(ROBONOVA.servo[ktore].value!=wartosc){
if(GetTickCount()-tick>10){
a=Memory_read(32+ktore,0x03);
ROBONOVA.servo[ktore].value=a;
tick=GetTickCount();
}
}
}
float Voltage(){
int value;
AD_getdata(5);
return (10*ROBONOVA.sensor[5].value)/256;
}
int Memory_read(int low,int high){
int a;
SerialPutc(hCom,0xF7);SerialGetc(hCom);
SerialPutc(hCom,low);SerialGetc(hCom);
SerialPutc(hCom,high);SerialGetc(hCom);
SerialPutc(hCom,0x00);a=SerialGetc(hCom);
return a;
}
void Reboot(){
int A,a,b,c,d;
SerialPutc(hCom,0xAF); A=SerialGetc(hCom);
SerialPutc(hCom,0x62); a=SerialGetc(hCom);
SerialPutc(hCom,0x6F); b=SerialGetc(hCom);
SerialPutc(hCom,0x6F); c=SerialGetc(hCom);
SerialPutc(hCom,0x74); d=SerialGetc(hCom);
if(a==0x42 && b==0x4f && c==0x4f && d==0x54){SetStatusText("Boot sequence OK");ROBONOVA.bootsequence=1;}
else{
sprintf(sts,"[0%x] Boot sequence strange: %x %x %x %x - RESTARTING",A,a,b,c,d);
SetStatusText(sts);
Reboot();
}
}
void Servo_move(int which,int position){
SerialPutc(hCom,0xE6);SerialGetc(hCom); //move servo
SerialPutc(hCom,which);SerialGetc(hCom); //ktore serwo
SerialPutc(hCom,position);SerialGetc(hCom); //position
}
void MOVEG6A(int a, int b, int c, int d,int e,int f){
SerialPutc(hCom,0xEB);SerialGetc(hCom);//SYNC MOVE
SerialPutc(hCom,0);SerialGetc(hCom);
SerialPutc(hCom,6);SerialGetc(hCom);
SerialPutc(hCom,a);SerialGetc(hCom);
SerialPutc(hCom,b);SerialGetc(hCom);
SerialPutc(hCom,c);SerialGetc(hCom);
SerialPutc(hCom,d);SerialGetc(hCom);
SerialPutc(hCom,e);SerialGetc(hCom);
SerialPutc(hCom,f);SerialGetc(hCom);
}
void MOVEG6B(int a, int b, int c, int d,int e, int f){
SerialPutc(hCom,0xEB);SerialGetc(hCom);//SYNC MOVE
SerialPutc(hCom,6);SerialGetc(hCom);
SerialPutc(hCom,6);SerialGetc(hCom);
//
SerialPutc(hCom,a);SerialGetc(hCom);
SerialPutc(hCom,b);SerialGetc(hCom);
SerialPutc(hCom,c);SerialGetc(hCom);
SerialPutc(hCom,d);SerialGetc(hCom);
SerialPutc(hCom,e);SerialGetc(hCom);
SerialPutc(hCom,f);SerialGetc(hCom);
}
void MOVEG6C(int a, int b, int c, int d,int e, int f){
SerialPutc(hCom,0xEB);SerialGetc(hCom);//SYNC MOVE
SerialPutc(hCom,12);SerialGetc(hCom);
SerialPutc(hCom,6);SerialGetc(hCom);
//
SerialPutc(hCom,a);SerialGetc(hCom);
SerialPutc(hCom,b);SerialGetc(hCom);
SerialPutc(hCom,c);SerialGetc(hCom);
SerialPutc(hCom,d);SerialGetc(hCom);
SerialPutc(hCom,0);SerialGetc(hCom); //servo IR
SerialPutc(hCom,f);SerialGetc(hCom);
}
void MOVEG6D(int a, int b, int c, int d,int e, int f){
SerialPutc(hCom,0xEB);SerialGetc(hCom);//SYNC MOVE
SerialPutc(hCom,18);SerialGetc(hCom);
SerialPutc(hCom,6);SerialGetc(hCom);
//
SerialPutc(hCom,a);SerialGetc(hCom);
SerialPutc(hCom,b);SerialGetc(hCom);
SerialPutc(hCom,c);SerialGetc(hCom);
SerialPutc(hCom,d);SerialGetc(hCom);
SerialPutc(hCom,e);SerialGetc(hCom);
SerialPutc(hCom,f);SerialGetc(hCom);
}
void MOVE24(int a, int b, int c, int d, int e ,int f, int g, int h, int i, int j , int k, int l,int m, int n,int o, int p, int q, int r, int s,int t, int u, int v, int w, int x){
SerialPutc(hCom,0xEB);SerialGetc(hCom);//SYNC MOVE
SerialPutc(hCom,0);SerialGetc(hCom);
SerialPutc(hCom,24);SerialGetc(hCom);
//Off we go.
SerialPutc(hCom,a);SerialGetc(hCom);
SerialPutc(hCom,b);SerialGetc(hCom);
SerialPutc(hCom,c);SerialGetc(hCom);
SerialPutc(hCom,d);SerialGetc(hCom);
SerialPutc(hCom,e);SerialGetc(hCom);
SerialPutc(hCom,f);SerialGetc(hCom);
SerialPutc(hCom,g);SerialGetc(hCom);
SerialPutc(hCom,h);SerialGetc(hCom);
SerialPutc(hCom,i);SerialGetc(hCom);
SerialPutc(hCom,j);SerialGetc(hCom);
SerialPutc(hCom,k);SerialGetc(hCom);
SerialPutc(hCom,0);SerialGetc(hCom); //servo iR
SerialPutc(hCom,m);SerialGetc(hCom);
SerialPutc(hCom,n);SerialGetc(hCom);
SerialPutc(hCom,o);SerialGetc(hCom);
SerialPutc(hCom,p);SerialGetc(hCom);
SerialPutc(hCom,q);SerialGetc(hCom);
SerialPutc(hCom,r);SerialGetc(hCom);
SerialPutc(hCom,s);SerialGetc(hCom);
SerialPutc(hCom,t);SerialGetc(hCom);
SerialPutc(hCom,u);SerialGetc(hCom);
SerialPutc(hCom,v);SerialGetc(hCom);
SerialPutc(hCom,w);SerialGetc(hCom);
SerialPutc(hCom,x);SerialGetc(hCom);
}
void SYNCMOVE(){
int A,a,b,c,d,e;
SerialPutc(hCom,0xEB);SerialGetc(hCom);//sync move
SerialPutc(hCom,0x06);SerialGetc(hCom);// start from servo no
SerialPutc(hCom,0x02);SerialGetc(hCom);// how many servoes ?
SerialPutc(hCom,0x64);SerialGetc(hCom);// servo1 pos
SerialPutc(hCom,0x64);SerialGetc(hCom);// servox pos
sprintf(sts,"WRONG %x %x %x %x %x",A,b,c,d,e);SetStatusText(sts);
}
void Servo_enable(int which){
SerialPutc(hCom,0xE7);// turn on the servo
SerialPutc(hCom,which);//ktore serwo
}
void AD_getdata(int port){
int b=0;
SerialPutc(hCom,0xE2); //Get data from AD
SerialGetc(hCom);
SerialPutc(hCom,port); //Pobieramy wartosc z AD.port
SerialGetc(hCom);
SerialPutc(hCom,0x00); //NULL
b=SerialGetc(hCom);
ROBONOVA.sensor[port].value=b;
}
void Servo_setspeed(int speed){
SerialPutc(hCom,0xE9);SerialGetc(hCom);//funkcja predkosc serwa
SerialPutc(hCom,speed);SerialGetc(hCom);//predkosc
}
//Konwertuje wartosc z czujnika na centymetry.
float IR_centimeter(int wartosc){
float oblicz=0;
if(wartosc>0){
oblicz=(1285/wartosc)*1.1060;
return oblicz;}else return 0;
}
int COM_open(){
DCB dcb;
BOOL fSuccess;
char *pcCommPort = "COM1";
hCom = CreateFile( pcCommPort,
GENERIC_READ | GENERIC_WRITE,
0, // must be opened with exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // must use OPEN_EXISTING
0, // not overlapped I/O
NULL // hTemplate must be NULL for comm devices
);
if (hCom == INVALID_HANDLE_VALUE)
{
// Handle the error.
printf ("CreateFile failed with error %d.\n", GetLastError());
return (1);
}
// Build on the current configuration, and skip setting the size
// of the input and output buffers with SetupComm.
fSuccess = GetCommState(hCom, &dcb);
if (!fSuccess)
{
// Handle the error.
printf ("GetCommState failed with error %d.\n", GetLastError());
return (2);
}
// Fill in DCB: 57,600 bps, 8 data bits, no parity, and 1 stop bit.
dcb.BaudRate = CBR_9600; // set the baud rate
dcb.ByteSize = 8; // data size, xmit, and rcv
dcb.Parity = NOPARITY; // no parity bit
dcb.StopBits = ONESTOPBIT; // one stop bit
fSuccess = SetCommState(hCom, &dcb);
if (!fSuccess)
{
// Handle the error.
MessageBox(0,"ERROR COM","",MB_OK);
return (3);
}
// hThread_networking = CreateThread( NULL, 0, THREAD_listenpackets, NULL, 0, &threadId_networking );
return (0);
}
int SerialGetc(HANDLE hCom)
{
char rxchar=0;
BOOL bReadRC;
char z[10];
static DWORD iBytesRead=NULL;;
memset(z,0,sizeof(z));
bReadRC = ReadFile(hCom, &rxchar, 1, &iBytesRead, NULL);
if(bReadRC!=TRUE || iBytesRead<1){
Sleep(1);
SerialGetc(hCom);
}else{
sprintf(z,"%i",rxchar);
return atoi(z);
}
}
void SerialPutc(HANDLE hCom, char txchar)
{
BOOL bWriteRC;
static DWORD iBytesWritten;
bWriteRC = WriteFile(hCom, &txchar, 1, &iBytesWritten,NULL);
if(bWriteRC!=TRUE || iBytesWritten<1>=320 ){
sprintf(sts,"%x%x = %i ",b,a,c);
SetStatusText(sts);
ROBONOVA.servo[wartosc-320].value=c;
}
/*
To keep you going:
The desired positions are stored in 24 memory locations from &H300.
The current positions are stored in 24 memory locations from &H320
They can both be PEEKed there.
When a move is started a bit is cleared in locations &H4E3, &H4E4, &H4E5.
there is one bit per servo starting at bit 0 in &H4E3.
When the current = the desired, then the corresponding bit is set.
A move is complete when all 3 bytes = &HFF
*/
// sprintf(PROCESSOR_status,"Memory red: 0x%x [%x,%x value: %i]",a,SerialGetc(hCom),SerialGetc(hCom),SerialGetc(hCom) );
break;
case 0xffffffd2:
a=0;b=0;c=0;d=0;
a=SerialGetc(hCom);
b=SerialGetc(hCom);
ROBONOVA.servo[a].value=b;
sprintf(GL_status,"%i=%i",a,b);
break;
case 0xffffffe2:
a=0;b=0;c=0;d=0;
a=SerialGetc(hCom);
b=SerialGetc(hCom);
sprintf(sts,"[0x%x] Data read from AD.%i, value=%i\n",A,a,b);
SetStatusText(sts);
ROBONOVA.sensor[a].value=b;
break;
case 0xffffffe9:
a=0;b=0;c=0;d=0;
a=SerialGetc(hCom);
sprintf(sts,"[0x%x] Servo speed to %x",A,a);
SetStatusText(sts);
break;
case 0xffffffe6:
a=0;b=0;c=0;d=0;
a=SerialGetc(hCom);
b=SerialGetc(hCom);
sprintf(sts,"[0x%x] Servo: %i to position %i",A,a,b);
SetStatusText(sts);
break;
case 0xffffffe7:
a=0;b=0;c=0;d=0;
a=SerialGetc(hCom);
b=SerialGetc(hCom);
sprintf(sts,"[0x%x] Servo: %i Enabled. %x",A,a,b);
SetStatusText(sts);
ROBONOVA.servo[a].enabled=1;
break;
}
}
return 0;
}
Hi,
I could read that this code is for comunicate with a Robonova with C++
but I could see that are not include the library, could you write wich librarys need you?
Thank you so much.