Skip to main content

Device Interface

SPAD.neXt device interface V2

SPAD.neXt can communicate with external devices like e.g. Arduino/Teensy via a very simple line based communication.

Request and reply on both sides will follow this format:

<ChannelId>,<Param1>[,...,<ParamN>];

tip

Thoughout the description of the device interface the following syntax will be used:

, is the separator for parameters

; is the terminator of a command

/ is used as escape character

[ ... ] defines optional parameter

<Name> defines an actual value. This can be a number or a string (without quotes!)

Anything not enclosed in <> defines the exact string (without quotes!)

danger

If , / ; are used within a parameter, they have to be escaped by a leading /.
E.g.
15,Hello/, from Arduino;

info

For a SPAD.neXt compatible Arduino library import CmdMessenger (4.0) into the Arduino IDE (recommended) or clone the github repository at https://github.com/thijse/Arduino-CmdMessenger

There is also a customized version available at the SPAD.neXt GitHub (TODO LINK) which includes SPAD.neXt specific functions to make device programming more easy.

info

The same protocol can be used to communicate with SPAD.neXt e.g. via a Websocket (TODO WEBSOCKET) and procide e.g. a custom webinterfaced device

Channel-ID's​

ChannelIDPurposeDirection
0General CommandsSPAD <--> Device
1Data CommandsDevice -> SPAD
2SPAD.neXt EventsSPAD -> Device
3DebugDevice -> SPAD
4Simulation EventDevice -> SPAD
5Data ChannelSPAD -> Device
6Device LED updatesSPAD -> Device
7Device Display updatesSPAD -> Device
8Device InputDevice -> SPAD
9(reserved for future use)
10 .. 49Dedicated Data ChannelsSPAD <-> Device
info

By default cmdMessenger is limited to a max of 50 channels to preserve device memory. You can change that by altering the line
#define MAXCALLBACKS 50
in cmdMessenger.h, however this is not recommended.

warning

For the specs of the Serial V1 protocol (still supported but deprecated) please see here.

danger

All <tag> or <targettag> are limited to the charactersA-Z,0-9,_