summaryrefslogtreecommitdiff
path: root/CODE/debugprewk/debug/IMU_comp/calcoffset
diff options
context:
space:
mode:
Diffstat (limited to 'CODE/debugprewk/debug/IMU_comp/calcoffset')
-rw-r--r--CODE/debugprewk/debug/IMU_comp/calcoffset/calcoffset.ino27
1 files changed, 27 insertions, 0 deletions
diff --git a/CODE/debugprewk/debug/IMU_comp/calcoffset/calcoffset.ino b/CODE/debugprewk/debug/IMU_comp/calcoffset/calcoffset.ino
new file mode 100644
index 0000000..fc5f752
--- /dev/null
+++ b/CODE/debugprewk/debug/IMU_comp/calcoffset/calcoffset.ino
@@ -0,0 +1,27 @@
+void setup() {
+ randomSeed(analogRead(0));
+ Serial.begin(9600);
+
+}
+
+void loop() {
+ int front = random(0, 360);
+ int heading = random(0, 360);
+ Serial.print("Front: ");
+ Serial.println(front);
+ Serial.print("heading: ");
+ Serial.println(heading);
+
+ int offset = heading - front;
+ if(offset<0){
+ offset=(offset+360);
+ }
+ Serial.print("offset: ");
+ Serial.println(offset);
+
+ Serial.println();
+ Serial.println();
+
+ delay(5000);
+
+}