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.
- 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 requires sudo privileges. Launch by typing sudo pigpiod
in the terminal.
using Pkg
Pkg.add("PiGPIO")
using PiGPIO
pi=Pi() #connect to pigpiod daemon on localhost
set_mode(pi::Pi, pin::Int, mode)
get_mode(pi::Pi, pin::Int)
# mode can be PiGPIO.INPUT or PiGPIO.OUTPUT
PiGPIO.read(pi, pin)
PiGPIO.write(pi, pin, state)
# state can be PiGPIO.HIGH, PiGPIO.LOW, PiGPIO.ON, PiGPIO.OFF
PiGPIO.set_PWM_dutycycle(pi, pin, dutycyle)
# dutycyle defaults to a range 0-255