Skip to content

Manage external hardware using GPIO pins on the Raspberry Pi

License

Notifications You must be signed in to change notification settings

Julia-Embedded/PiGPIO.jl

 
 

Repository files navigation

PiGPIO.jl

Control GPIO pins on the Raspberry Pi from Julia

PiGPIO

PiGPIO.jl is a Julia package for the Raspberry which communicates with the pigpio daemon to allow control of the general purpose input outputs (GPIO).

This package is an effective translation of the python package for the same. Which can be found here

Click here for an in-depth tutorial on how you can control GPIO pins such as LEDs from Julia on the Raspberry Pi.

Features

  • OS independent. Only Julia 1.0+ required.
  • Controls one or more Pi's.
  • Hardware timed pulse width modulation.
  • Hardware timed servo pulse.
  • Callbacks when any of GPIO change state.
  • Create and transmit precise waveforms.
  • Read/Write GPIO and set their modes.
  • Wrappers for I2C, SPI, and serial links.

Once a pigpio daemon is launched on the pi this package can connect to it and communicate with it to manipulate the GPIO pins of the pi. The actual work is done by the daemon. One benefit of working this way is that you can remotely access the pi over a network and multiple instances can be connected to the daemon simultaneously.

Launching the Daemon

Launching the daemon requires sudo privileges. Launch by typing sudo pigpiod in the terminal.

Installation and Usage

using Pkg
Pkg.add("PiGPIO")

using PiGPIO

pi=Pi() #connect to pigpiod daemon on localhost

Example Usage

set_mode(p::Pi, pin::Int, mode)
get_mode(p::Pi, pin::Int)
# mode can be INPUT or OUTPUT

PiGPIO.read(p, pin)
PiGPIO.write(p, pin, state)
#state can be HIGH, LOW, ON, OFF

PiGPIO.set_PWM_dutycycle(p, pin, dutycyle)
#dutycyle defaults to a range 0-255

About

Manage external hardware using GPIO pins on the Raspberry Pi

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Julia 100.0%