Problems "Setting GPIO mode with Notefile" from Feather ESP32

Trying to configure notecard for GPIO mode with Notefile from Feather ESP32 on Notecarrier AF.

I used the following sample C/C++ code for Notecard API for card.aux:
J *req = NoteNewRequest(“card.aux”);
JAddStringToObject(req, “mode”, “gpio”);

J *pins = JCreateArray();
JAddItemToArray(pins, “off”); // AUX1
JAddItemToArray(pins, “input-pullup”); // AUX2
JAddItemToArray(pins, “off”); // AUX3
JAddItemToArray(pins, “off”); // AUX4
JAddArrayToObject(req, “usage”, pins);

JAddBoolToObject(req, “sync”, true);
JAddStringToObject(req, “file”, “statechange.qo”);

NoteRequest(req);

Using the Arduino IDE and the most recent blues library, I get error on the JAddArrayToObject command, because in the n_json.c library the JAddArrayToObject function only accepts 2 parameters when being called: N_CJSON_PUBLIC(J*) JAddArrayToObject(J * const object, const char * const name).

Any suggestions on how to get this working would be appreciated.

The end goal is to use card.attn to wake up the ESP32 mcu when either the sleep interval expires or when the button connected to Aux2 is pushed.

I fixed my own problem, the card.aux sample code in the Notecard API appears to be wrong.

The following code works:
J *req = NoteNewRequest(“card.aux”);
JAddStringToObject(req, “mode”, “gpio”);
//J *pins = JCreateArray();
J *pins = JAddArrayToObject(req, “usage”);
JAddItemToArray(pins, JCreateString(“off”)); // AUX1
JAddItemToArray(pins, JCreateString(“input-pullup”)); // AUX2
JAddItemToArray(pins, JCreateString(“off”)); // AUX3
JAddItemToArray(pins, JCreateString(“off”)); // AUX4
// JAddArrayToObject(req, “usage”, pins);
JAddBoolToObject(req, “sync”, true);
JAddStringToObject(req, “file”, “statechange.qo”);

NoteRequest(req);
1 Like

Thanks @Karl_iWell - the only thing more frustrating than missing documentation is incorrect documentation! We will get this verified and updated ASAP.

Thanks,
Rob