Created
July 11, 2018 00:00
-
-
Save gguuss/d85a757dd7a2e6e511d4487e4c6179bf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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