Skip to content

Commit

Permalink
Merge pull request #6 from scls19fr/patch-1
Browse files Browse the repository at this point in the history
Syntax highlight
  • Loading branch information
aviks authored Oct 30, 2018
2 parents a30a6cd + 9ab315c commit d6db9b9
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ SenseHat.jl is a Julia library for interacting with the Raspberry Pi [Sense HAT]

SenseHat.jl requires the Raspbian `sense-hat` package:

sudo apt-get update
sudo apt-get install sense-hat
sudo reboot
```bash
sudo apt-get update
sudo apt-get install sense-hat
sudo reboot
```

## LED matrix

Expand All @@ -15,34 +17,39 @@ values (from [ColorTypes.jl](https://github.com/JuliaGraphics/ColorTypes.jl)) wh
memory-mapped to the frame buffer of the LED matrix. `led_clear()` is a convenience
function for resetting the LED matrix to black.

using SenseHat
using ColorTypes
```julia
using SenseHat
using ColorTypes

const LED = led_matrix()
const LED = led_matrix()

LED[:] = SenseHat.JULIA_LOGO
sleep(3)
led_clear()
LED[:] = SenseHat.JULIA_LOGO
sleep(3)
led_clear()
```

## Joystick

In the `Stick` module there is `readstick()` which will block until the joystick is
manipulated, returning a `StickEvent`:

using SenseHat
```julia
using SenseHat

e = readstick()
e = readstick()
```

For querying within a loop, use a `Channel` to create a buffer of `StickEvent`.

using SenseHat
```julia
using SenseHat

c = Channel{StickEvent}(32)

@async while true
put!(c, readstick())
end
c = Channel{StickEvent}(32)

@async while true
put!(c, readstick())
end
```

## Sensors

Expand Down

0 comments on commit d6db9b9

Please sign in to comment.