Skip to content

Instantly share code, notes, and snippets.

@OEP
Created July 6, 2012 21:26
Show Gist options
  • Save OEP/3062835 to your computer and use it in GitHub Desktop.
Save OEP/3062835 to your computer and use it in GitHub Desktop.
Drive Primitive
public void write(byte bytes[]) {
int opcode = bytes[0];
opcode = (opcode < 0) ? opcode + 256 : opcode;
int velocity = (bytes[1] << 8) | (bytes[2] & 0xFF);
int radius = (bytes[3] << 8) | (bytes[4] & 0xFF);
System.out.println("write(" + opcode + ", " + velocity + ", " + radius + ")");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment