ROBOTC.net forums
http://robotc.net/forums/

Just learning C, I have a rookie question
http://robotc.net/forums/viewtopic.php?f=11&t=6893
Page 1 of 1

Author:  Airbagjay [ Sun Oct 06, 2013 11:48 pm ]
Post subject:  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 ++;

}

}

Author:  Ernest3.14 [ Mon Oct 07, 2013 9:44 pm ]
Post subject:  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.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/