Skip to content

Protocol

Michael Fennel edited this page May 16, 2015 · 1 revision

Introduction

The used protocol for transmitting data from Android to Arduino is very simple: The bluetooth connection is in SPP-mode (Serial Port Profile). Each datagram consists of 6 bytes and represents a complete and independent command. If an error occurs during receiving (byte lost) the receiver will wait until a new delimiter byte is detected. Since the delimiter char is ambigous, this procedure can be repeated until a valid datagramm will be received.

Datagram structure

Each datagram has the following structure. Currently, only one way communication is implemented.

  • Byte 0: address of the LED (for future use, currently always 0x00, but is not checked by Arduino)
  • Byte 1: LED mode
    • 0x00 monochrome mode
    • 0x01 fading mode
  • Byte 2-4: options
  • Byte 5: delimiter byte ';'

In monochrome mode byte 2-4 have to following content:

  • Byte 2: red value (unsigned char)
  • Byte 3: green value (unsigned char)
  • Byte 4: blue value (unsigned char)

In fading mode byte 2-4 have the following content:

  • Byte 2: speed from 0 (low speed) to 255 (high speed)
  • Byte 3: animation turned on (0x00) or turned off (0x01)
  • Byte 4: unused

Clone this wiki locally