summaryrefslogtreecommitdiff
path: root/CODE/debug/prewk/IMU_comp/calcoffset/calcoffset.ino
diff options
context:
space:
mode:
authorrobosoccer <robosoccer@mendelcollege.nl>2025-03-20 12:06:06 +0100
committerrobosoccer <robosoccer@mendelcollege.nl>2025-03-20 12:06:06 +0100
commit7e9328765f41a6055a722285678bc6bc09963c07 (patch)
tree7e02d638585b455fcea38a8e88d5fc71c3fcd1ba /CODE/debug/prewk/IMU_comp/calcoffset/calcoffset.ino
parent2bcc96fb10a4a84a7e5537d1d3258a7f919b6917 (diff)
downloadrobotica-7e9328765f41a6055a722285678bc6bc09963c07.tar.gz
robotica-7e9328765f41a6055a722285678bc6bc09963c07.zip
update
Diffstat (limited to 'CODE/debug/prewk/IMU_comp/calcoffset/calcoffset.ino')
-rw-r--r--CODE/debug/prewk/IMU_comp/calcoffset/calcoffset.ino27
1 files changed, 27 insertions, 0 deletions
diff --git a/CODE/debug/prewk/IMU_comp/calcoffset/calcoffset.ino b/CODE/debug/prewk/IMU_comp/calcoffset/calcoffset.ino
new file mode 100644
index 0000000..fc5f752
--- /dev/null
+++ b/CODE/debug/prewk/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);
+
+}