Go to Post Isn't FIRST robotics the answer to life, the universe, and everything? - weberr [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

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 16-02-2013, 20:40
omsahmad's Avatar
omsahmad omsahmad is offline
Registered User
FRC #1595 (Dragons)
 
Join Date: Oct 2010
Rookie Year: 2011
Location: Spokane, WA
Posts: 66
omsahmad is just really niceomsahmad is just really niceomsahmad is just really niceomsahmad is just really niceomsahmad is just really nice
Printing values to user messages box

Very simple question, whose answer I cannot figure out. I am using a CAN bus system to control the speed of my motors. I think it is working but I want to display the value of the encoder in the user messages box. How exactly do I accomplish this? Currently only text is showing up in the messages box.

DriverStationLCD is lcd

my code:

lcd->Printf(DriverStationLCD::kUser_Line3, 1, "Rate: ", shooterOne->GetSpeed);
lcd->UpdateLCD();

Thanks
Reply With Quote
  #2   Spotlight this post!  
Unread 16-02-2013, 22:34
Kevin Sevcik's Avatar
Kevin Sevcik Kevin Sevcik is offline
(Insert witty comment here)
FRC #0057 (The Leopards)
Team Role: Mentor
 
Join Date: Jun 2001
Rookie Year: 1998
Location: Houston, Texas
Posts: 3,708
Kevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond reputeKevin Sevcik has a reputation beyond repute
Send a message via AIM to Kevin Sevcik Send a message via Yahoo to Kevin Sevcik
Re: Printing values to user messages box

You need to use standard printf formatting.

Your line should be something like:
lcd->Printf(DriverStationLCD::kUser_Line3, 1, "Rate: %f", shooterOne->GetSpeed());

Also, calling the Clear() method first tends to prevent weird overwriting problems that muddle the output.
__________________
The difficult we do today; the impossible we do tomorrow. Miracles by appointment only.

Lone Star Regional Troubleshooter
Reply With Quote
  #3   Spotlight this post!  
Unread 16-02-2013, 23:59
omsahmad's Avatar
omsahmad omsahmad is offline
Registered User
FRC #1595 (Dragons)
 
Join Date: Oct 2010
Rookie Year: 2011
Location: Spokane, WA
Posts: 66
omsahmad is just really niceomsahmad is just really niceomsahmad is just really niceomsahmad is just really niceomsahmad is just really nice
Re: Printing values to user messages box

Quote:
Originally Posted by Kevin Sevcik View Post
You need to use standard printf formatting.

Your line should be something like:
lcd->Printf(DriverStationLCD::kUser_Line3, 1, "Rate: %f", shooterOne->GetSpeed());

Also, calling the Clear() method first tends to prevent weird overwriting problems that muddle the output.
I put the parentheses after GetSpeed, I just forgot them here. I did not have %f, however. I'll try it out tomorrow.

Thank you.

EDIT: It worked perfectly, thanks

Last edited by omsahmad : 17-02-2013 at 13:04.
Reply With Quote
Reply


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


All times are GMT -5. The time now is 03:31.

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