|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Function for O over a serial.
I am a happy computer programmer and well never played around with a robot before. Being a computer programmer I am use to the computer standard ways of doing things. I wrote this for the robot
Code:
#include <stdio.h>
#define AMOUNT_OF_LINES 1
int reprint(void)
{
int i,x,r;
int farray[200],*fa;
FILE *fp;
fp = fopen("c:\\text3.txt", "r");
fa = &farray[0];
for(x=0;x<123;x++)
{
*(fa+x) = (fgetc( fp ));
printf("%s",fa+x);
}
fclose(fp);
}
int write(void)
{
int c,x,i,y,n, *sp, string[200];
sp = &string[0];
FILE *fp;
fp=fopen("c:\\text3.txt", "w");
for(x=0;x<3;x++){
scanf("%s",sp+x); }
for(n=0;n<3;n++) {
fprintf(fp,"%s",sp+n); }
fclose(fp);
}
int main() {
int x;
write();
reprint();
scanf("%d",x);
/* by metalgod4eva team 870 */
}
/*for loops not complete, still need to make another function */
|
|
#2
|
||||
|
||||
|
Re: Function for O over a serial.
The code for the robot isnt exactly like standard C for a computer, you might want to look at the default code
www.kevin.org/frc And read the programming ref guide from IFI http://www.ifirobotics.com/docs/lega...2-apr-2004.pdf |
|
#3
|
|||
|
|||
|
Re: Function for O over a serial.
If I understand this is what you want. Just Printf all you info like you normally would. But write a custom app that reads those values and logs them to a text file. Is that what you want?
|
|
#4
|
||||
|
||||
|
Re: Function for O over a serial.
Even simpler, forget a custom App, depending on the kind of data you're using a properly formatted printf(), Hyperterm and Excel are your best friend.
I had to monitor the PID response for last years robot and a bunch of numbers wasn't doing it for me, so I had a printf like this: Code:
printf("%d,%d,%d,%d,%d",kp, ki, kd, error, output); // This is a loose guess at what it was
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Dampening function for driving. | Brad Voracek | Programming | 2 | 13-01-2007 14:18 |
| Loop time for OperatorControl function? Debug blows... | Chris_Elston | Programming | 10 | 13-02-2006 14:42 |
| USB serial adapter for OSX? | Validius | Programming | 1 | 05-01-2006 01:43 |
| FIRST Over For WRONG 1430 | russell | General Forum | 13 | 26-11-2005 16:01 |
| USB to Serial converter for controller | Ryan Collings | Programming | 10 | 22-01-2005 13:14 |