Skip to content

Latest commit

 

History

History
83 lines (53 loc) · 1.33 KB

OPCODES.md

File metadata and controls

83 lines (53 loc) · 1.33 KB

Websocket Op Codes

The firmware expects a set of instructions, through a websocket buffer.

All instructions can accept arguments as bytes (the bytes after the Op Code byte). The length of arguments may vary with different instructions.

This is what a command looks like from a buffer

Op Byte Arg1 ArgX
0x7F 0x01 ...

This doc file sources from command.h where the enum definition for Op codes can be found

Some core bindings are missing, since they were not used durring development.



GPIO Mode

Set the mode of a GPIO pin

Arguments(1):

  • Mode of the pin (see modes)

Response(2):

  • Ok

Example:

0x7F 0x03

GPIO Write

write to a GPIO pin

Arguments(1):

  • State of the Pin

Response(2):

  • Ok

Example:

0x80 0x01

Motor Control

Control motors through PWM

Arguments(2):

  • Left motor percentage from -100 to 100
  • Right motor percentage from -100 to 100

Response(2):

  • Ok

Example:

0xC0 -50 50

Trigger Ultrasound

Get a distance value from the Ultrasound sensor

Response(2):

  • MSByte of distance value
  • LSByte of distance value

Example:

0xD0