# Problems "Setting GPIO mode with Notefile" from Feather ESP32

**URL:** <https://discuss.blues.com/t/problems-setting-gpio-mode-with-notefile-from-feather-esp32/916>\
**Category:** Notecard API\
**Created:** [July 28, 2022, 3:22pm UTC](https://discuss.blues.com/t/problems-setting-gpio-mode-with-notefile-from-feather-esp32/916 "2022-07-28T15:22:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karl\_iWell](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@Karl\_iWell](https://discuss.blues.com/u/Karl_iWell)\
**Post date:** [July 28, 2022, 3:22pm UTC](https://discuss.blues.com/t/problems-setting-gpio-mode-with-notefile-from-feather-esp32/916/1 "2022-07-28T15:22:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Karl\_iWell](https://avatars.discourse-cdn.com/v4/letter/k/7feea3/32.png) [@Karl\_iWell](https://discuss.blues.com/u/Karl_iWell)\
**Post date:** [July 28, 2022, 4:58pm UTC](https://discuss.blues.com/t/problems-setting-gpio-mode-with-notefile-from-feather-esp32/916/2 "2022-07-28T16:58:02Z")

</div>

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);

```

---

<div class="post-metadata">

**Author:** ![RobLauer](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.blues.com/roblauer/32/1567_2.png) [@RobLauer](https://discuss.blues.com/u/RobLauer)\
**Post date:** [July 29, 2022, 5:42pm UTC](https://discuss.blues.com/t/problems-setting-gpio-mode-with-notefile-from-feather-esp32/916/3 "2022-07-29T17:42:51Z")

</div>

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

Thanks,  
Rob
