Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Technicus/191c33d428f7a08ef18c to your computer and use it in GitHub Desktop.
Save Technicus/191c33d428f7a08ef18c to your computer and use it in GitHub Desktop.
int checkSensors(byte whichSensor, byte howManyBytes){
int timeOut = 40;
roombaSerial.write(149);
roombaSerial.write((byte)howManyBytes);
for (int x = 0; x < howManyBytes ; x++) {
roombaSerial.write((byte)whichSensor++);
}
int bufferPos = 0;
while(howManyBytes) {
while (roombaSerial.available() == 0) {
delayMicroseconds(1);
}
response[bufferPos++] = roombaSerial.read();
howManyBytes -= 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment