04949080
pfrison
PercTeacher stabl...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
public class SerialCommands {
public static void sendDeltas(SerialCom serialCom, int deltaLeft, int deltaRight) {
byte dataL1 = (byte) ((deltaLeft & 0xFF00) >> 8);
byte dataL2 = (byte) (deltaLeft & 0xFF);
byte dataR1 = (byte) ((deltaRight & 0xFF00) >> 8);
byte dataR2 = (byte) (deltaRight & 0xFF);
byte[] data = new byte[] {dataL1, dataL2, dataR1, dataR2};
serialCom.send(data);
// wait for a response = move complete
byte[] bytes = null;
while(bytes == null
|| bytes.length <= 0) {
bytes = serialCom.recieve();
}
}
}
|