File tree Expand file tree Collapse file tree 1 file changed +24
-17
lines changed Expand file tree Collapse file tree 1 file changed +24
-17
lines changed Original file line number Diff line number Diff line change @@ -4,9 +4,11 @@ SenseHat.jl is a Julia library for interacting with the Raspberry Pi [Sense HAT]
4
4
5
5
SenseHat.jl requires the Raspbian ` sense-hat ` package:
6
6
7
- sudo apt-get update
8
- sudo apt-get install sense-hat
9
- sudo reboot
7
+ ``` bash
8
+ sudo apt-get update
9
+ sudo apt-get install sense-hat
10
+ sudo reboot
11
+ ```
10
12
11
13
## LED matrix
12
14
@@ -15,34 +17,39 @@ values (from [ColorTypes.jl](https://github.com/JuliaGraphics/ColorTypes.jl)) wh
15
17
memory-mapped to the frame buffer of the LED matrix. ` led_clear() ` is a convenience
16
18
function for resetting the LED matrix to black.
17
19
18
- using SenseHat
19
- using ColorTypes
20
+ ``` julia
21
+ using SenseHat
22
+ using ColorTypes
20
23
21
- const LED = led_matrix()
24
+ const LED = led_matrix ()
22
25
23
- LED[:] = SenseHat.JULIA_LOGO
24
- sleep(3)
25
- led_clear()
26
+ LED[:] = SenseHat. JULIA_LOGO
27
+ sleep (3 )
28
+ led_clear ()
29
+ ```
26
30
27
31
## Joystick
28
32
29
33
In the ` Stick ` module there is ` readstick() ` which will block until the joystick is
30
34
manipulated, returning a ` StickEvent ` :
31
35
32
- using SenseHat
36
+ ``` julia
37
+ using SenseHat
33
38
34
- e = readstick()
39
+ e = readstick ()
40
+ ```
35
41
36
42
For querying within a loop, use a ` Channel ` to create a buffer of ` StickEvent ` .
37
43
38
- using SenseHat
44
+ ``` julia
45
+ using SenseHat
39
46
40
- c = Channel{StickEvent}(32)
41
-
42
- @async while true
43
- put!(c, readstick())
44
- end
47
+ c = Channel {StickEvent} (32 )
45
48
49
+ @async while true
50
+ put! (c, readstick ())
51
+ end
52
+ ```
46
53
47
54
## Sensors
48
55
You can’t perform that action at this time.
0 commit comments