Trouble understanding basic library code

I am having trouble unstanding some basic code in the MKRNB library.

In the simplified code below i am printing NB_READY, which is a constant according to the keywords.txt of the MKRNB library files. It prints 3.

#include <MKRNB.h>

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  while(!Serial);
  Serial.println("Serial communication started");
  Serial.println(NB_READY);
}

void loop() {
  // put your main code here, to run repeatedly:
}

When i am searching for the constant NB_READY in all of the 23 sources files of the MKRNB library i can't find it anywhere being declared.

Does anyone know where it is being declared? I feel like i am missing something obvious.

Thanks in advance!

Count the enums from 0 at the far left

1 Like

NB_READY is NOT a constant but an enumeration value which by default start from 0, so according to line 25 of source file NB.h it's equal to 3

1 Like

In your picture at line 25

1 Like

You guys are fast! Thanks for answer, totally make sense now :smile:

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.