Skip to main content

Datatypes

The DTYPE code in B0 messages identifies each signal's data type. The same codes determine how many bytes to read per signal in data frames.

Type Table

User TypeAVR32-bit Platform
boolDTYPE 0 (1 byte)DTYPE 0 (1 byte)
byteDTYPE 1 (1 byte)DTYPE 1 (1 byte)
shortDTYPE 2 (2 bytes)DTYPE 2 (2 bytes)
unsigned shortDTYPE 3 (2 bytes)DTYPE 3 (2 bytes)
intDTYPE 4 (2 bytes)DTYPE 6 (4 bytes)
unsigned intDTYPE 5 (2 bytes)DTYPE 7 (4 bytes)
longDTYPE 6 (4 bytes)DTYPE 6 (4 bytes)
unsigned longDTYPE 7 (4 bytes)DTYPE 7 (4 bytes)
floatDTYPE 8 (4 bytes)DTYPE 8 (4 bytes)
doubleDTYPE 8 (4 bytes)DTYPE 9 (8 bytes)

blaecktcpy uses the same mapping as 32-bit platforms.

The protocol automatically handles platform differences in data type sizes:

AVR (Arduino Uno, Nano, Mega, etc.):

  • int and unsigned int are 2 bytes
  • double has no precision advantage over float (both 4 bytes)

32-bit Platforms (ESP32, ESP8266, Arduino Due, etc.):

  • int and unsigned int are 4 bytes and get automatically mapped to long/unsigned long protocol types
  • double provides true 8-byte double precision

See Also

  • Elements — DTYPE field definition
  • Frames — B0 and D2 payload layouts