summaryrefslogtreecommitdiff
path: root/gyro.ino
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-12-19 20:14:11 +0100
committerHampusM <hampus@hampusmat.com>2021-12-19 20:14:11 +0100
commit991381a67d00f2fa8dcf0475172b0151b4310385 (patch)
tree5f2b46a584c1c5261f3276687eb7fd98c561572a /gyro.ino
parent4fdb27130e3c53c9a55cc73b8975aae733a03e90 (diff)
refactor: use the GY521 sensor instead
Diffstat (limited to 'gyro.ino')
-rw-r--r--gyro.ino51
1 files changed, 0 insertions, 51 deletions
diff --git a/gyro.ino b/gyro.ino
deleted file mode 100644
index 0f9aff6..0000000
--- a/gyro.ino
+++ /dev/null
@@ -1,51 +0,0 @@
-#include <Wire.h>
-
-#include "gyroscope.hpp"
-
-/*
- Stops the execution of any more instructions.
-*/
-void stop()
-{
- while (1)
- ;
-}
-
-Gyroscope gyroscope;
-
-void setup()
-{
- Serial.begin(9600);
-
- // Wait for Serial because the Arduino Leonardo is weird
- while (!Serial)
- ;
-
- int gyroscope_id = Gyroscope::initialize();
-
- // Verifiy the gyroscope id
- if (gyroscope_id == -1)
- {
- Serial.println("Error: Failed to communicate with gyroscope component");
- stop();
- }
-
- gyroscope.setup(gyroscope_id);
-
- Serial.println("Finished setup");
-}
-
-void loop()
-{
- int16_t x, y, z;
- gyroscope.readCoordinates(&x, &y, &z);
-
- Serial.print("X: ");
- Serial.print((int)x);
- Serial.print(" Y: ");
- Serial.print((int)y);
- Serial.print(" Z: ");
- Serial.println((int)z);
-
- delay(1000);
-} \ No newline at end of file