Jump to content

max() Function does not work in Energia-0101E0017

Recommended Posts

Hi everyone,

I am using a Black Launchpad and this does not work in the latest version of Energia which is 1.6.10E18.

So I switched back to the version 0101E0017 to make use of the Black Launchpad.

My code is below and tried in Arduino IDE and working fine:

float a = 3.5;
  float b = 2.0;
  float result = 0.00;
void setup() {
  // put your setup code here, to run once:


void loop() {
  // put your main code here, to run repeatedly:
  result = max(a,b);


Using the same code in version 0101E0017 produces a compilation error that "max" was not defined.

In 1.6.10E18, this works but it is impossible to upload this program using the Black Launchpad.

Any suggestions for this error?


Thanks and Good Day,


Link to post
Share on other sites
4 hours ago, Fmilburn said:

I do not know why it is not there - it is in the Reference section of the Energia documentation.  Probably an oversight that was corrected in V18.

However, see this link for an implementation using a macro:  https://stackoverflow.com/questions/3437404/min-and-max-in-c

This solution works also for removing the compilation error.


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...