Skip to content

Commit cb430bf

Browse files
authored
Merge pull request #11 from lornajane/readme-upgrade
Add a little structure to the readme, check examples and invite comment
2 parents 6e732a3 + f14fa50 commit cb430bf

File tree

1 file changed

+48
-4
lines changed

1 file changed

+48
-4
lines changed

README.md

Lines changed: 48 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,42 @@
1-
A Go interface to an Elgato StreamdeckXL (specifically the 32-button version)
1+
# Go Streamdeck
2+
3+
A Go interface to an Elgato Streamdeck (currently works with the 32-button XL only because that's what I have).
24

35
[![GoDoc](https://godoc.org/github.com/magicmonkey/go-streamdeck?status.svg)](https://godoc.org/github.com/magicmonkey/go-streamdeck)
46

7+
_Designed for and tested with Ubuntu, Go 1.13+ and a Streamdeck XL. Images are the wrong size for other streamdecks; bug reports and patches are welcome!_
8+
9+
## Installation
10+
11+
Either include the library in your project or install it with the following command:
12+
13+
```
14+
go get github.com/magicmonkey/go-streamdeck
15+
```
16+
17+
## Usage
18+
519
There are 2 ways to use this: the low-level "comms-oriented" interface (using `streamdeck.Open`) which wraps the USB HID protocol, or the higher-level "button-oriented" interface (using `streamdeck.New`) which represents buttons and actions.
620

721
If you want to implement your own actions, I suggest that you either instantiate a `CustomAction` or alternatively implement the `ButtonActionHandler` interface (basing your code on the `CustomerAction`).
822

9-
Example high-level usage:
23+
### Example high-level usage
24+
25+
High level usage gives some helpers to set up buttons. This example has a few things to look at:
26+
27+
* A button in position 2 that says "Hi world" and prints to the console when pressed
28+
29+
* A button in position 7 displaying the number 7 - changes to number 8 when pressed.
30+
31+
* A yellow button in position 26
32+
33+
* A purple button in position 27, it changes colour _and_ prints to the console when pressed.
34+
1035
```go
1136
import (
37+
"image/color"
38+
"time"
39+
1240
streamdeck "github.com/magicmonkey/go-streamdeck"
1341
"github.com/magicmonkey/go-streamdeck/actionhandlers"
1442
"github.com/magicmonkey/go-streamdeck/buttons"
@@ -31,7 +59,7 @@ func main() {
3159

3260
// A button with text on it which changes when pressed
3361
myNextButton := buttons.NewTextButton("7")
34-
myNextButton.SetActionHandler(&actionhandlers.TextLabelChange{NewLabel: "8"})
62+
myNextButton.SetActionHandler(&actionhandlers.TextLabelChangeAction{NewLabel: "8"})
3563
sd.AddButton(7, myNextButton)
3664

3765
// A button which performs multiple actions when pressed
@@ -46,7 +74,14 @@ func main() {
4674
}
4775
```
4876

49-
Example low-level usage:
77+
The program runs for 20 seconds and then exits.
78+
79+
### Example low-level usage
80+
81+
The low-level usage gives more control over the operations of the streamdeck and buttons.
82+
83+
This example shows an image on any pressed button, updating each time another button is pressed.
84+
5085
```go
5186
import streamdeck "github.com/magicmonkey/go-streamdeck"
5287

@@ -66,5 +101,14 @@ func main() {
66101
sd.ClearButtons()
67102
sd.WriteImageToButton("play.jpg", btnIndex)
68103
})
104+
105+
time.Sleep(20 * time.Second)
106+
69107
}
70108
```
109+
110+
The program runs for 20 seconds and then exits.
111+
112+
## Contributions
113+
114+
This is a very new project but all feedback, comments, questions and patches are more than welcome. Please get in touch by opening an issue, it would be good to hear who is using the project and how things are going.

0 commit comments

Comments
 (0)