Finding the biggest number in NXC

Discussion specific to NXT-G, NXC, NBC, RobotC, Lejos, and more.
penguinplus
Posts: 12
Joined: 16 Nov 2010, 01:29

Re: Finding the biggest number in NXC

Post by penguinplus »

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.
h-g-t
Posts: 552
Joined: 07 Jan 2011, 08:59
Location: Albania

Re: Finding the biggest number in NXC

Post by h-g-t »

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.
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.
afanofosc
Site Admin
Posts: 1256
Joined: 26 Sep 2010, 19:36
Location: Nashville, TN
Contact:

Re: Finding the biggest number in NXC

Post by afanofosc »

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
Multi-platform LEGO MINDSTORMS programming
http://bricxcc.sourceforge.net/
penguinplus
Posts: 12
Joined: 16 Nov 2010, 01:29

Re: Finding the biggest number in NXC

Post by penguinplus »

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.
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests