So my problem here is I don't know how to get the text file (which is full of 1000 line-by-line commands written in Venus 2) to be correctly entered into the while loop I tried to create for repeatedly sending the position commands to the motors. There's a text file which has coordinates written in Venus 2 commands (little known language; very annoying to work with). I'm not an aficionado at c++ computer programming but I do know most basic and intermediate level c++ ideals. If you have any suggestions or comments, let me know what you think!!
also, here's a snippet of what the file looks like
0.0229 1 nm 0.0317 2 nm
0.0276 1 nm 0.0311 2 nm
0.0323 1 nm 0.0302 2 nm
0.0347 1 nm 0.0310 2 nm
0.0364 1 nm 0.0310 2 nm
0.0422 1 nm 0.0343 2 nm
0.0466 1 nm 0.0324 2 nm
position, motorID, motiontype, position, motorID, motiontype
(NI Pollux II motor x2)
//text file is opened
int i = 0;
double c1[1000];
char line;
cout << "Press any key to begin jitter.\n";
cin.get();
cout << "Running the jitter data...\n";
/* here there should be a conversion from double to char */
while (!jitterFile.eof()) {
jitterFile >> c1[i];
/* or here there should be a conversion */
if (serial.Open(18, 19200)){
static char szMessage[] = /* here is where the converted data should go */;
int nBytesSent = serial.SendData(szMessage, strlen(szMessage));
assert(nBytesSent == strlen(szMessage));
}
else{
cout << "error occurred with runJitter()...\n";
}
cout << c1[i] << endl;
++i;
}
//Sleep(1000);
jitterFile.close();
return 0;
}