# The "awgrover/buffer1" library does not work

**URL:** <https://forum.xod.io/t/the-awgrover-buffer1-library-does-not-work/6936>\
**Category:** Uncategorized\
**Created:** [August 16, 2024, 10:25am UTC](https://forum.xod.io/t/the-awgrover-buffer1-library-does-not-work/6936 "2024-08-16T10:25:17Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nazarijtipusak080](https://avatars.discourse-cdn.com/v4/letter/n/7c8e57/32.png) [@nazarijtipusak080](https://forum.xod.io/u/nazarijtipusak080)\
**Post date:** [August 16, 2024, 10:25am UTC](https://forum.xod.io/t/the-awgrover-buffer1-library-does-not-work/6936/1 "2024-08-16T10:25:17Z")

</div>

When trying to simulate or fill in the Arduino, it gives an error: Generating C++ code for simulation…  
Building…  
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:995:9: error: unknown type name ‘byte’  
byte \*buffer;  
^  
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:1106:9: error: use of undeclared identifier ‘DEBUG\_SERIAL’  
DEBUG\_SERIAL.print(F(“buffer1/buffer1 tried to allocate 0 bytes\n”)); // exception  
^  
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:1269:9: error: use of undeclared identifier ‘DEBUG\_SERIAL’  
DEBUG\_SERIAL.print(F(“buffer1/”));DEBUG\_SERIAL.print(F(“fill”)); DEBUG\_SERIAL.print(F(" saw unallocated buffer1\n")); // exception  
^  
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:1269:43: error: use of undeclared identifier ‘DEBUG\_SERIAL’  
DEBUG\_SERIAL.print(F(“buffer1/”));DEBUG\_SERIAL.print(F(“fill”)); DEBUG\_SERIAL.print(F(" saw unallocated buffer1\n")); // exception  
^  
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:1269:74: error: use of undeclared identifier ‘DEBUG\_SERIAL’  
DEBUG\_SERIAL.print(F(“buffer1/”));DEBUG\_SERIAL.print(F(“fill”)); DEBUG\_SERIAL.print(F(" saw unallocated buffer1\n")); // exception  
^  
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:2372:9: error: use of undeclared identifier ‘DEBUG\_SERIAL’  
DEBUG\_SERIAL.print(F(“buffer1/”));DEBUG\_SERIAL.print(F(“get-word”)); DEBUG\_SERIAL.print(F(" saw unallocated buffer1\n")); // exception  
^  
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:2372:43: error: use of undeclared identifier ‘DEBUG\_SERIAL’  
DEBUG\_SERIAL.print(F(“buffer1/”));DEBUG\_SERIAL.print(F(“get-word”)); DEBUG\_SERIAL.print(F(" saw unallocated buffer1\n")); // exception  
^  
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:2372:78: error: use of undeclared identifier ‘DEBUG\_SERIAL’  
DEBUG\_SERIAL.print(F(“buffer1/”));DEBUG\_SERIAL.print(F(“get-word”)); DEBUG\_SERIAL.print(F(" saw unallocated buffer1\n")); // exception  
^  
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:2853:9: error: use of undeclared identifier ‘DEBUG\_SERIAL’  
DEBUG\_SERIAL.print(F(“buffer1/”));DEBUG\_SERIAL.print(F(“set-word”)); DEBUG\_SERIAL.print(F(" saw unallocated buffer1\n")); // exception  
^  
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:2853:43: error: use of undeclared identifier ‘DEBUG\_SERIAL’  
DEBUG\_SERIAL.print(F(“buffer1/”));DEBUG\_SERIAL.print(F(“set-word”)); DEBUG\_SERIAL.print(F(" saw unallocated buffer1\n")); // exception  
^  
/ws/sketchbook/56173aad4548869a64bc481eb7cd1fa1b66dad001e999846f2a6250b4821fba5/sketch/sketch.ino:2853:78: error: use of undeclared identifier ‘DEBUG\_SERIAL’  
DEBUG\_SERIAL.print(F(“buffer1/”));DEBUG\_SERIAL.print(F(“set-word”)); DEBUG\_SERIAL.print(F(" saw unallocated buffer1\n")); // exception  
^  
11 errors generated.  
shared:ERROR: ‘/ws/arduino\_data/packages/xod/tools/emscripten/1.39.2/bin/clang++ -target wasm32-unknown-emscripten -D\_\_EMSCRIPTEN\_major\_\_=1 -D\_\_EMSCRIPTEN\_minor\_\_=39 -D\_\_EMSCRIPTEN\_tiny\_\_=1 -D\_LIBCPP\_ABI\_VERSION=2 -Dunix -D\_\_unix -D\_\_unix\_\_ -Werror=implicit-function-declaration -Xclang -nostdsysteminc -Xclang -isystem/ws/arduino\_data/packages/xod/tools/emscripten/1.39.2/emscripten/system/include/libcxx -Xclang -isystem/ws/arduino\_data/packages/xod/tools/emscripten/1.39.2/emscripten/system/lib/libcxxabi/include -Xclang -isystem/ws/arduino\_data/packages/xod/tools/emscripten/1.39.2/emscripten/system/include/compat -Xclang -isystem/ws/arduino\_data/packages/xod/tools/emscripten/1.39.2/emscripten/system/include -Xclang -isystem/ws/arduino\_data/packages/xod/tools/emscripten/1.39.2/emscripten/system/include/libc -Xclang -isystem/ws/arduino\_data/packages/xod/tools/emscripten/1.39.2/emscripten/system/lib/libc/musl/arch/emscripten -Xclang -isystem/ws/arduino\_data/packages/xod/tools/emscripten/1.39.2/emscripten/system/local/include -DLLVM\_ROOT=/ws/arduino\_data/packages/xod/tools/emscripten/1.39.2/bin -DARDUINO\_WASM\_SIMULATION -DARDUINO\_ARCH\_WASM -O2 -std=c++11 -nostdlib -fno-exceptions -fno-rtti -c -I/tmp/arduino-sketch-13D110D66947A2AF222576651E78202F/sketch -I/ws/arduino\_data/packages/xod/hardware/wasm/0.3.2/cores/simulation -I/ws/arduino\_data/packages/xod/hardware/wasm/0.3.2/variants/simulation -DEMSCRIPTEN /tmp/arduino-sketch-13D110D66947A2AF222576651E78202F/sketch/sketch.ino.cpp -Xclang -isystem/ws/arduino\_data/packages/xod/tools/emscripten/1.39.2/emscripten/system/include/SDL -c -o /tmp/arduino-sketch-13D110D66947A2AF222576651E78202F/preproc/ctags\_target\_for\_gcc\_minus\_e.cpp -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr’ failed (1)  
Error during build: exit status 1

The generated C++ code contains errors. It can be due to a bad node implementation  
or if your board is not compatible with XOD runtime code. The original compiler error  
message is above. Fix C++ errors to continue. If you believe it is a bug, report the  
problem to XOD developers.

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [August 16, 2024, 1:17pm UTC](https://forum.xod.io/t/the-awgrover-buffer1-library-does-not-work/6936/2 "2024-08-16T13:17:52Z")

</div>

Which board are you compiling for? Can you provide minimal code that can reproduce the error?

---

<div class="post-metadata">

**Author:** ![nazarijtipusak080](https://avatars.discourse-cdn.com/v4/letter/n/7c8e57/32.png) [@nazarijtipusak080](https://forum.xod.io/u/nazarijtipusak080)\
**Post date:** [August 16, 2024, 3:02pm UTC](https://forum.xod.io/t/the-awgrover-buffer1-library-does-not-work/6936/3 "2024-08-16T15:02:06Z")

</div>

To begin with, I ran the examples that are in the library. It threw the same error…Next, I tried simple algorithms, initialized an array of 3 characters, wrote down a number for the indicated number “i”, and then from this array I output my number to “watch”. The same error also appeared.

---

<div class="post-metadata">

**Author:** ![nazarijtipusak080](https://avatars.discourse-cdn.com/v4/letter/n/7c8e57/32.png) [@nazarijtipusak080](https://forum.xod.io/u/nazarijtipusak080)\
**Post date:** [August 19, 2024, 8:58am UTC](https://forum.xod.io/t/the-awgrover-buffer1-library-does-not-work/6936/4 "2024-08-19T08:58:24Z")

</div>

Friend @gweimer, I’m trying to use nth-input as an array of data nodes, it used to solve my problems. The problem is only in memory optimization, because I am making a project for atduino nano with output to oled (ssd1306). Please tell me how to display information about the remaining memory during the setup process, and how to do it? Also, will the replacement of number type data with byte type data (the range from 0 to 255 is enough for me) give an optimization effect? Thanks in advance!

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [August 19, 2024, 3:29pm UTC](https://forum.xod.io/t/the-awgrover-buffer1-library-does-not-work/6936/5 "2024-08-19T15:29:51Z")

</div>

Looks like nth-input only exists for number & string; my guess would be byte input would use number. Oddly enough, when I create an nth-input node with tweak-byte connected to X0, it compiles fine. If I connect a tweak-number, it complains about conflicting specializations & wants me to explicitly use nth-input(number)

After uploading code, the Compiler tab will show memory used/free for code and variables.

Uploading nth-input with tweak-byte and 35 inputs, I get  
Sketch uses 8422 bytes (17%) of program storage space. Maximum is 48640 bytes.  
Global variables use 248 bytes (4%) of dynamic memory, leaving 5896 bytes for local variables. Maximum is 6144 bytes.

Uploading nth-input(number) with 35 inputs, I get  
Sketch uses 9868 bytes (20%) of program storage space. Maximum is 48640 bytes.  
Global variables use 360 bytes (5%) of dynamic memory, leaving 5784 bytes for local variables. Maximum is 6144 bytes.

So byte input actually does use less memory.

---

<div class="post-metadata">

**Author:** ![nazarijtipusak080](https://avatars.discourse-cdn.com/v4/letter/n/7c8e57/32.png) [@nazarijtipusak080](https://forum.xod.io/u/nazarijtipusak080)\
**Post date:** [August 19, 2024, 4:45pm UTC](https://forum.xod.io/t/the-awgrover-buffer1-library-does-not-work/6936/6 "2024-08-19T16:45:26Z")

</div>

Dear @gweimer, you must be tired of me, but you always give valuable advice. So the question is again about the nth input node, which is based on the if-else node. Would it be possible to achieve even more optimization if the variables are not initialized as auto but as uint8\_t?

---

<div class="post-metadata">

**Author:** ![gweimer](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@gweimer](https://forum.xod.io/u/gweimer)\
**Post date:** [August 20, 2024, 1:10am UTC](https://forum.xod.io/t/the-awgrover-buffer1-library-does-not-work/6936/7 "2024-08-20T01:10:58Z")

</div>

My guess would be that auto is converted to the appropriate data type before handing off to the compiler, hence the difference in variable space used when I tried nth-input with byte & number inputs above. The XOD developers put quite a bit of work into optimizing the code they hand off to the compiler.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/eb7348baa04192c2ef932d1db54d44f09f8a7888.png) [@system](https://forum.xod.io/u/system)\
**Post date:** [September 19, 2024, 1:11am UTC](https://forum.xod.io/t/the-awgrover-buffer1-library-does-not-work/6936/8 "2024-09-19T01:11:55Z")

</div>

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