# Use circuits\_{i2c,gpio} as dependency in an erlang project

**URL:** <https://erlangforums.com/t/use-circuits-i2c-gpio-as-dependency-in-an-erlang-project/2248>\
**Category:** Questions / Help\
**Tags:** elixir, build-tool, erlang\
**Created:** [January 9, 2023, 12:38pm UTC](https://erlangforums.com/t/use-circuits-i2c-gpio-as-dependency-in-an-erlang-project/2248 "2023-01-09T12:38:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dischoen](https://erlangforums.com/user_avatar/erlangforums.com/dischoen/32/695_2.png) [@dischoen](https://erlangforums.com/u/dischoen)\
**Post date:** [January 9, 2023, 12:38pm UTC](https://erlangforums.com/t/use-circuits-i2c-gpio-as-dependency-in-an-erlang-project/2248/1 "2023-01-09T12:38:33Z")

</div>

Hi all,

I need to control some hardware in a new project, where I want to use and adapt an existing erlang project.  
My current approach is to use i2c and gpio from the circuits family.  
All together needs to run on a raspberry.

I seem to have a problem with the configuration in the erlang project.  
Here is my current rebar.config:

```erlang
{erl_opts, [debug_info]}.
{deps, [
        {circuits_i2c, "1.1.0"},
        {circuits_gpio, "1.0.1"}
]}.

{shell, [
  % {config, "config/sys.config"},
    {apps, [erlangapp]}
]}.

{plugins, [rebar_mix]}.
{provider_hooks, [
  {post, [{compile, {mix, consolidate_protocols}}]}
]}.

```

The build output looks ok:

```erlang
===> Compiling circuits_i2c
Resolving Hex dependencies...
Resolution completed in 0.263s
New:
  bunt 0.2.1
  credo 1.6.7
  dialyxir 1.2.0
  earmark_parser 1.4.29
  elixir_make 0.7.3
 [..]
==> elixir_make
Compiling 6 files (.ex)
Generated elixir_make app
==> circuits_i2c
 CC hal_i2cdev.o
 CC i2c_nif.o
 LD i2c_nif.so
Compiling 2 files (.ex)

```

However, the nif library is not created.

To crosscheck, I created a small elixir library, where I could successfully build all.  
So I made sure that I have all necessary tools installed.  
There the build artifacts are in the directory circuits\_\*/priv/, which is not created in the erlang library.

Did anybody run in a similar problem already?  
Debugging the C Makefile did not succeed so far, because it seems it is being recreated before each build.  
I would be grateful for any pointers!

---

<div class="post-metadata">

**Author:** ![AstonJ](https://erlangforums.com/user_avatar/erlangforums.com/astonj/32/9_2.png) [@AstonJ](https://erlangforums.com/u/AstonJ)\
**Post date:** [January 13, 2023, 5:19pm UTC](https://erlangforums.com/t/use-circuits-i2c-gpio-as-dependency-in-an-erlang-project/2248/2 "2023-01-13T17:19:12Z")

</div>

11 posts were split to a new topic: [GPIO - Erlang GPIO interface](https://erlangforums.com/t/gpio-erlang-gpio-interface/2262)
