View Single Post
  #3   Spotlight this post!  
Unread 16-01-2008, 19:02
kaszeta's Avatar
kaszeta kaszeta is offline
Registered User
FRC #0095 (Grasshoppers)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Lebanon, NH
Posts: 334
kaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of lightkaszeta is a glorious beacon of light
Re: printf causes programs to not run

Quote:
Originally Posted by psy_wombats View Post
The fast loop, I believe, can't support the printf function, simply because it is a very fast loop. The printf takes a lot of time (relaying info through your serial) so the print is being called way too fast for it to finish, and causes the program error.
I've done this successfully (when debugging shaft encoders), but wouldn't recommend it. It's very easy to crash things this way.

Quote:
Should be able to fix by calling only by a timer interrupt, or when a loop count is divisible by fifty, (to call every fiftieth loop or something), or maybe use the slow loop?
This is of course a much better solution.