View unanswered posts | View active topics It is currently Mon Jul 28, 2014 10:23 am






Reply to topic  [ 2 posts ] 
Just learning C, I have a rookie question 
Author Message
Rookie

Joined: Sun Oct 06, 2013 11:33 pm
Posts: 1
Post Just learning C, I have a rookie question
So to learn C I set a goal that I thought was realistic and tried to write the code to make it happen.

My first goal is to simply make a counter on the display. I want to get it to count from 0 to 200 then stop. "tall" is just a random name I picked. I noticed in robotc that "tall" is in black text not colored. I know the code as it is will not work, it gives me a "Procedure call Parameter" error for the displayLCDCenteredString line of code. Any help for this would be great. Thanks in advance. Jay




task main ()
{
int tall = 0;

while ( tall < 200)
{

clearLCDLine(0);
clearLCDLine(1);
bLCDBacklight = true;
displayLCDCenteredString(0,tall); //How to I display the value of "tall" in the display
wait1Msec(250);

tall ++;

}

}


Sun Oct 06, 2013 11:48 pm
Profile
Professor
User avatar

Joined: Sat May 18, 2013 1:24 pm
Posts: 272
Location: Olympia, WA
Post Re: Just learning C, I have a rookie question
And by the way, next time add
Code:
 [code][/code]
around your code to make it more readable ;)
What you need to do for `displayLCDCenteredString` is use something like this:
Code:
displayLCDCenteredString(0, "%f", tall);

Does that work?
See this page for further reference. http://www.cplusplus.com/reference/cstdio/printf/
Do note that in everyday programming, the use of ellipses is quite rare, and it's considered "evil" by many :) But "printf" is a pretty standard function.

_________________
FTC Team 6424, the 'Oly Cow - Chief programmer.
FRC Team 4450, Olympia Robotics Federation (ORF).

and also quadrotors. Quadrotors!


Mon Oct 07, 2013 9:44 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  



Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.