Page 2 of 2

Re: Finding the biggest number in NXC

Posted: 25 Aug 2011, 22:25
by penguinplus
All it does is count up. goes 0 0 1 2 3 then it says 3.

Re: Finding the biggest number in NXC

Posted: 25 Aug 2011, 22:36
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.

Re: Finding the biggest number in NXC

Posted: 26 Aug 2011, 06:24
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

Re: Finding the biggest number in NXC

Posted: 26 Aug 2011, 13:43
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.