Skip to content

Instantly share code, notes, and snippets.

@gguuss
Created July 11, 2018 00:00
Show Gist options
  • Save gguuss/d85a757dd7a2e6e511d4487e4c6179bf to your computer and use it in GitHub Desktop.
Save gguuss/d85a757dd7a2e6e511d4487e4c6179bf to your computer and use it in GitHub Desktop.
void postRange() {
String data = "{\"deviceId\": \"" + String(device_id)
+ "\", \"time\": " + String(time(nullptr)) + ", \"range\": \"" +
String(getRangeCm(), DEC) + " cm\", \"scanId\": \""+ String(scanId) +
"\", \"scanAngle\": \"" + String(HEXBUG_ROT % 360) + " deg\"}";
sendTelemetry(data);
Serial.println(data);
}
// Test surroundings
bool scanDone = true;
void scan() {
Serial.println("scan");
if (!scanDone) {
for (int i=0; i < 6; i++) {
hexbug_spider_spin(20);
postRange();
while (!backoff()) {
delay(10);
}
}
}
scanDone = true; // Only do one scan per config change
scanId++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment