Finding the biggest number in NXC
-
- Posts: 12
- Joined: 16 Nov 2010, 01:29
Re: Finding the biggest number in NXC
All it does is count up. goes 0 0 1 2 3 then it says 3.
I take the place of Penguinplus from the old forums.
Re: Finding the biggest number in NXC
My apologies, my rather basic method did not return all the data you might need.
However,
string Max;
float max = 0;
if (L1>max) max = L1, Max = "L1";
if (L2>max) max = L2, Max = "L2";
and so forth should suffice if you do not want to get involved in arrays at this time.
However,
string Max;
float max = 0;
if (L1>max) max = L1, Max = "L1";
if (L2>max) max = L2, Max = "L2";
and so forth should suffice if you do not want to get involved in arrays at this time.
A sophistical rhetorician, inebriated with the exuberance of his own verbosity, and gifted with an egotistical imagination that can at all times command an interminable and inconsistent series of arguments to malign an opponent and to glorify himself.
Re: Finding the biggest number in NXC
The key here is that you have to tell the compiler to target the enhanced NBC/NXC firmware since ArrayMax requires that firmware version. If you have the standard firmware on your NXT and BricxCC has the "automatic firmware version" option checked (which it has by default) then you will get this compiler error.
John Hansen
John Hansen
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
http://bricxcc.sourceforge.net/
-
- Posts: 12
- Joined: 16 Nov 2010, 01:29
Re: Finding the biggest number in NXC
Thank you h-g-t. You solved the problem. I probably look really dumb as I didn't know how to do that but it was not shown in the NXC tutorial. Your code worked great. That ends my problem thanks.
I take the place of Penguinplus from the old forums.
Who is online
Users browsing this forum: Semrush [Bot] and 0 guests