|
| 1 | +# PiGPIO.jl |
| 2 | + |
| 3 | +Documentation for PiGPIO.jl |
| 4 | + |
| 5 | +### Control GPIO pins on the Raspberry Pi from Julia |
| 6 | + |
| 7 | +[](https://www.youtube.com/watch?v=UmSQjkaATk8) |
| 8 | + |
| 9 | +PiGPIO.jl is a Julia package for the Raspberry which communicates with the pigpio |
| 10 | +daemon to allow control of the general purpose |
| 11 | +input outputs (GPIO). |
| 12 | + |
| 13 | +This package is an effective translation of the python package for the same. |
| 14 | +Which can be found [here](http://abyz.me.uk/rpi/pigpio/python.html) |
| 15 | + |
| 16 | +## Features |
| 17 | + |
| 18 | +* OS independent. Only Julia 1.0+ required. |
| 19 | +* Controls one or more Pi's. |
| 20 | +* Hardware timed pulse width modulation. |
| 21 | +* Hardware timed servo pulse. |
| 22 | +* Callbacks when any of GPIO change state. |
| 23 | +* Create and transmit precise waveforms. |
| 24 | +* Read/Write GPIO and set their modes. |
| 25 | +* Wrappers for I2C, SPI, and serial links. |
| 26 | + |
| 27 | +Once a pigpio daemon is launched on the pi this package can connect to |
| 28 | +it and communicate with it to manipulate the GPIO pins of the pi. The actual |
| 29 | +work is done by the daemon. One benefit of working this way is that you can |
| 30 | +remotely access the pi over a network and multiple instances can be connected |
| 31 | +to the daemon simultaneously. |
| 32 | + |
| 33 | +Launching the daemon requires sudo privileges. Launch by typing `sudo pigpiod` |
| 34 | +in the terminal. |
| 35 | + |
| 36 | +## Installation and Usage |
| 37 | + |
| 38 | +```julia |
| 39 | +using Pkg |
| 40 | +Pkg.add("https://github.com/JuliaBerry/PiGPIO.jl") |
| 41 | + |
| 42 | +using PiGPIO |
| 43 | + |
| 44 | +pi=Pi() #connect to pigpiod daemon on localhost |
| 45 | +``` |
| 46 | + |
| 47 | +## Example Usage |
| 48 | + |
| 49 | +```julia |
| 50 | +set_mode(p::Pi, pin::Int, mode) |
| 51 | +get_mode(p::Pi, pin::Int) |
| 52 | +# mode can be INPUT or OUTPUT |
| 53 | + |
| 54 | +read(p, pin) |
| 55 | +write(p, pin, state) |
| 56 | +#state can be HIGH, LOW, ON, OFF |
| 57 | + |
| 58 | +set_PWM_dutycycle(p, pin, dutycyle) |
| 59 | +#dutycyle defaults to a range 0-255 |
| 60 | +``` |
0 commit comments