View Single Post
  #3   Spotlight this post!  
Unread 21-01-2010, 22:53
sircedric4's Avatar
sircedric4 sircedric4 is offline
Registered User
AKA: Darren
no team (The SS Prometheus)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Lousiana
Posts: 245
sircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond reputesircedric4 has a reputation beyond repute
Re: Printing Float to Dashboard

We ran into this exact same problem yesterday and after searching online for an hour and getting nowhere on the cocanate issue i finally found this link which was immensely helpful.

http://www.cppreference.com/wiki/c/io/printf

Like the poster above me showed, I kept finding convoluted methods to do something that is extremely trivial in other program languages. After evaluating the DriverStationLCD class and seeing it was probably inheriting most of its features from the C++ printf class I figured I would give the %f thing in the link above a try. When we tried it this evening it worked perfect.

Your code might look like this as an example:

dsLCD->Printf(DriverStationLCD::kUser_Line4, 1,"Joystick Y axis: %f", driveController->GetY());

The %f is a placeholder waiting for a float variable to be passed. Hope this helps you out.
Reply With Quote