diff options
Diffstat (limited to 'gyro.ino')
-rw-r--r-- | gyro.ino | 51 |
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 |