summaryrefslogtreecommitdiff
path: root/CODE/debugprewk/debug/IMU_comp/calcoffset/calcoffset.ino
diff options
context:
space:
mode:
authorAbel Tim <abel@abel-ms7c95.home>2025-03-17 21:43:59 +0100
committerAbel Tim <abel@abel-ms7c95.home>2025-03-17 21:43:59 +0100
commit9c8f7e2f1101b4bb8e0c5459e14af253f150c8b7 (patch)
treef6baef3949190537fb37f3ac21b965f83c8f7407 /CODE/debugprewk/debug/IMU_comp/calcoffset/calcoffset.ino
parentbf474ec55fce14f778efa1c1e8118d69a093bf07 (diff)
downloadrobotica-9c8f7e2f1101b4bb8e0c5459e14af253f150c8b7.tar.gz
robotica-9c8f7e2f1101b4bb8e0c5459e14af253f150c8b7.zip
code
Diffstat (limited to 'CODE/debugprewk/debug/IMU_comp/calcoffset/calcoffset.ino')
-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);
+
+}