Skip to content

Julia package for the Raspberry Pi Sense HAT

License

Notifications You must be signed in to change notification settings

Julia-Embedded/SenseHat.jl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SenseHat.jl

version

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

LED matrix

The main interface is the led_matrix() function, which creates an 8×8 array of RGB values (from ColorTypes.jl) which is 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

const LED = led_matrix()

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

e = readstick()

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

using SenseHat

c = Channel{StickEvent}(32)

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

Sensors

humidity(), temperature() and pressure() will read values from the corresponding sensors.

The inertial measurement unit (IMU) is not yet supported, but is coming soon. In the meantime, you can use the python library via PyCall.jl.

About

Julia package for the Raspberry Pi Sense HAT

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Julia 100.0%