View Single Post
  #10   Spotlight this post!  
Unread 02-06-2010, 19:45
michael714's Avatar
michael714 michael714 is offline
Registered User
FRC #3863 (Pantherbotics)
Team Role: Teacher
 
Join Date: Apr 2006
Rookie Year: 2007
Location: Newbury Park, CA
Posts: 46
michael714 is on a distinguished road
Re: serial out and printf with WPILib

Ok, another interesting discovery today. After much trial and error, we figured out why outputting to the serial port only worked sometimes. Actually, we never figured out why, we merely figured out how to get output consistently. For some reason, we had to have some kind of delay at the beginning of our program. This is really strange because we had the output looping and it did not work.

Anyway, by adding a Wait(1000) statement at the beginning of the code, we were able to get printf to the terminal and serial output to the SparkFun SerLCD display consistently. After we discovered this little trick, we then stumbled across a chiefdelphi thread that came to the same conclusion:

http://www.chiefdelphi.com/forums/sh...ad.php?t=62384

Interestingly, the thread also said that they couldn't get printf to work with WPILib when they had a function other than main(). We may experiment with that a bit more another day. However, I'm hoping that this info is helpful to anyone else having problems using printf or serial out with WPILib. Because if you can get it to work, than you can have a nice inexpensive serial LCD display for your vex (http://www.sparkfun.com/commerce/pro...ducts_id=9393).