Go to Post It's about compressing life into 6 weeks. It's about doing. It's about learning to fail. It's about gracious professionalism. It's about releasing the limitations that we all put on ourselves. It's about thinking outside of the box. It's about growing. - JohnBoucher [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Spotlight this post!  
Unread 21-01-2010, 23:19
TheDominis TheDominis is offline
Registered User
FRC #2152
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Port Orange, Florida
Posts: 88
TheDominis has a spectacular aura aboutTheDominis has a spectacular aura about
Re: Printing Float to Dashboard

Quote:
Originally Posted by sircedric4 View Post
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.
printf isn't a class! printf is a function! Also other programming languages (I assume you mean Java, C#, VB, etc) probably use printf or at least a function similar to the one C uses. In fact, float to string is trivial.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with printing float windell747 Programming 3 12-02-2008 10:23
printing FLOAT data type on the terminal window razer Programming 14 05-02-2007 08:55
Robots that float boy_scout72688 Rules/Strategy 31 15-01-2007 22:18
Float Design i like dirt Technical Discussion 3 13-09-2006 00:21
Float in MPLAB capenga Programming 1 18-02-2005 06:44


All times are GMT -5. The time now is 12:14.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi