More buttonreader documentation
This commit is contained in:
parent
66ddb39bbe
commit
0c5d94d211
27
Readme.md
27
Readme.md
|
@ -106,6 +106,33 @@ device, baudrate (default 9600), parity (default N) and stop-bits (default 1).
|
|||
As with the fifo, an ASCII-number for the player which pressed a button is
|
||||
expected. All other characters are ignored.
|
||||
|
||||
*BeopardySerial* mimics the protocol used by the Beopary software. It reads
|
||||
from a serial device and takes the same arguments as *Serial*, but in addition
|
||||
to taking button presses from the serial it also gives feedback about the
|
||||
current gamestate.
|
||||
|
||||
*Unix* opens up a unix domain socket on your local filesystem, first argument
|
||||
being the path to where it should be created. To send a player button press,
|
||||
send its ASCII number ('1'-'9' is supported). The board will send a 'O' if
|
||||
the buzzers (buttons) are open and a 'C' when they are closed. To indicate
|
||||
that it is a player's turn the board will send a "TX", where X is the current
|
||||
player's number (e.g. "T3" for player 3).
|
||||
|
||||
Examples:
|
||||
|
||||
# use BeopardySerial
|
||||
playerInput:
|
||||
- Type: BeopardySerial
|
||||
Args:
|
||||
- /dev/ttyUSB0
|
||||
- 19200
|
||||
|
||||
# use a unix domain socket
|
||||
playerInput:
|
||||
- Type: Unix
|
||||
Args:
|
||||
- /tmp/seopardy.sock
|
||||
|
||||
Writing an own class for player input should be fairly easy. Within its own
|
||||
thread the class can do whatever it wants (including blocking I/O). When it
|
||||
wants to signal a button was pressed it just needs to emit a ButtonEvent.
|
||||
|
|
Loading…
Reference in New Issue