View Single Post
  #4   Spotlight this post!  
Unread 13-01-2008, 10:19
PhilBot's Avatar
PhilBot PhilBot is offline
Get a life? This IS my life!
AKA: Phil Malone
FRC #1629 (GaCo: The Garrett Coalition)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2006
Location: Maryland
Posts: 747
PhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond reputePhilBot has a reputation beyond repute
Re: A Portable Serial Data-logger for the FRC Robot Controller

Quote:
Originally Posted by mluckham View Post
I asked the question today, whether Easy/C printf output can be redirected to the 2nd serial port.

I looked at the WPILIB documentation, it is dead simple to output to the second serial port - but there is no printf - so you will have to supply your own.
I've not used Easy C, but if you can output to the second serial port, then maybe you can use sprintf()

sprintf is just like printf, except that instead of sending text to the "console" it writes the resultant text to a string variable.

So if you declare a char array:

char Buffer[128] ;

And then write your data to that using sprintf..

sprintf(Buffer, "%d,%d,%d\r\n", test1, test2, test3);

Then you can send Buffer to the second serial port.

You need to make sure that Buffer is big enough for ANY single string you want to write out.

Phil.
__________________
Phil Malone
Garrett Engineering And Robotics Society (GEARS) founder.
http://www.GEARSinc.org

FRC1629 Mentor, FTC2818 Coach, FTC4240 Mentor, FLL NeXTGEN Mentor