Arduino spirit Level using gyroscope with LED
Arduino spirit Level using gyroscope with 11-LED Parts list: Arduino Nano: https://goo.gl/Gox61E Gyroscope: https://goo.gl/vxP6zG Prototype Breadboard: https://goo.gl/jxEJx5 LED Kit: https://goo.gl/UDemfT Resistor Kit: https://goo.gl/TvFJWz Circuit: Video: Code: #include <Wire.h> //Declaring some global variables int gyro_x, gyro_y, gyro_z; long gyro_x_cal, gyro_y_cal, gyro_z_cal; boolean set_gyro_angles; long acc_x, acc_y, acc_z, acc_total_vector; float angle_roll_acc, angle_pitch_acc; float angle_pitch, angle_roll; int angle_pitch_buffer, angle_roll_buffer; float angle_pitch_output, angle_roll_output; long loop_timer; int temp; void setup() { pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT); pinMode(6,OUTPUT); pinMode(7,OUTPUT); pinMode(8,OUTPUT); pinMode(9,OUTPUT); pinMode(10,OUTPUT); pinMode(11,OUTPUT); pinMode(12,OUTPUT); pinMode(13,OUTPUT); Wire.begin(); //Start I2C as master setup_mpu_