# Julia, PiGPIO for Button control

**URL:** <https://discourse.julialang.org/t/julia-pigpio-for-button-control/49862>\
**Category:** New to Julia\
**Created:** [November 9, 2020, 7:09pm UTC](https://discourse.julialang.org/t/julia-pigpio-for-button-control/49862 "2020-11-09T19:09:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hub\_Spencer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hub_spencer/32/19291_2.png) [@Hub\_Spencer](https://discourse.julialang.org/u/Hub_Spencer)\
**Post date:** [November 9, 2020, 7:09pm UTC](https://discourse.julialang.org/t/julia-pigpio-for-button-control/49862/1 "2020-11-09T19:09:01Z")

</div>

I’m new to Julia and I’m just toying with the language on Raspberry Pi with the PiGPIO library. Is there doc on how to use the PiGPIO.callback function to monitor Edge transitions? I can see the method, but no examples.

More specifically, I have code that looks like:

```
  function gpioCallback(gpio, level, tick)
     println("gpioCallback")
  end
  ...

  remotePi=Pi()
  println("Connected to " * remotePi.host)
  ...

  println("Testing callbacks")
  set_mode(remotePi,26,PiGPIO.INPUT)
  cb = PiGPIO.callback(remotePi,26,PiGPIO.FALLING_EDGE,gpioCallback)

```

The error I see indicates that I need some initialization of the Pi struct (remotePi)

```
  **[ Info:** Successfully connected!
  Connected to raspberrypi
  Testing callbacks
  **ERROR:** LoadError: type Pi has no field _notify

  Stacktrace:
  [1] **getproperty(** ::Pi, ::Symbol **)** at **./Base.jl:33**
  [2] **callback(** ::Pi, ::Int64, ::Int64, ::Function **)** at 
  **/Users/hub/.julia/packages/PiGPIO/bH87w/src/pi.jl:1229**
  [3] top-level scope at **/Users/hub/Julia/TestPi.jl:25**
  [4] **include(** ::Function, ::Module, ::String **)** at **./Base.jl:380**
  [5] **include(** ::Module, ::String **)** at **./Base.jl:368**
  [6] **exec_options(** ::Base.JLOptions **)** at **./client.jl:296**
  [7] **_start()** at **./client.jl:506**
  in expression starting at /Users/hub/Julia/TestPi.jl:25

```

Any thoughts?

---

<div class="post-metadata">

**Author:** ![contradict](https://avatars.discourse-cdn.com/v4/letter/c/ac91a4/32.png) [@contradict](https://discourse.julialang.org/u/contradict)\
**Post date:** [November 10, 2020, 12:53am UTC](https://discourse.julialang.org/t/julia-pigpio-for-button-control/49862/2 "2020-11-10T00:53:26Z")

</div>

That looks like a bug. Looking at the [source](https://github.com/ronisbr/BaremetalPi.jl/blob/master/src/gpio.jl), `_notify` is accessed several times but only `notify` is defined or written. I think all instances of `_notify` in that file should be `notify`.

---

<div class="post-metadata">

**Author:** ![Hub\_Spencer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hub_spencer/32/19291_2.png) [@Hub\_Spencer](https://discourse.julialang.org/u/Hub_Spencer)\
**Post date:** [November 10, 2020, 11:53am UTC](https://discourse.julialang.org/t/julia-pigpio-for-button-control/49862/3 "2020-11-10T11:53:44Z")

</div>

Thanks, I’ll check to see if there is a newer package.

---

<div class="post-metadata">

**Author:** ![theomouyen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/theomouyen/32/26180_2.png) [@theomouyen](https://discourse.julialang.org/u/theomouyen)\
**Post date:** [March 24, 2021, 11:44am UTC](https://discourse.julialang.org/t/julia-pigpio-for-button-control/49862/4 "2021-03-24T11:44:52Z")

</div>

Hi, any follow up on this issue ? I have the same error when using PiGPIO.callback .

---

<div class="post-metadata">

**Author:** ![bionicinnovations1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/bionicinnovations1/32/22874_2.png) [@bionicinnovations1](https://discourse.julialang.org/u/bionicinnovations1)\
**Post date:** [May 22, 2021, 2:39pm UTC](https://discourse.julialang.org/t/julia-pigpio-for-button-control/49862/5 "2021-05-22T14:39:55Z")

</div>

Hi all, I am also looking for some help with PiGPIO. It would be great to see some examples in Julia for acquiring sensor inputs using I2C and SPI protocols, but I can’t find any examples whatsoever!
