code for the speed robot

Dependencies:   MPU6050-DMP mbed PololuQTRSensors vl53l0x

_var.h

Committer:
deepanaishtaweera174
Date:
2019-10-01
Revision:
8:d7941bcd9981
Parent:
7:fd80a0d11658

File content as of revision 8:d7941bcd9981:

I2C i2c(PB_9,PB_8);
Timer t;

VL53L0X Sensor3(&i2c,&t); //Right Sensor
VL53L0X Sensor2(&i2c,&t); //Left Sensor
VL53L0X Sensor1(&i2c,&t); //Front Sensor
int right_Distance;
int left_Distance;
int front_Distance;

// Gyro Variables
MPU6050 mpu;
volatile bool mpuInterrupt = false;
unsigned long savedMillis;
bool gyroTurnMode = false;
int zAngle = 0;
int xAngle = 0;
int preZAngle = 0;
int preXAngle = 0;
int startAngle = 0;
unsigned long preGyroMillis = 0;

// MPU control/status vars
bool dmpReady = false; // set true if DMP init was successful
uint8_t mpuIntStatus;  // holds actual interrupt status byte from MPU
uint8_t devStatus;
uint16_t packetSize; // expected DMP packet size (default is 42 bytes)
uint16_t fifoCount;
uint8_t fifoBuffer[64];

// orientation/motion vars
Quaternion q;        // [w, x, y, z]         quaternion container
VectorInt16 aa;      // [x, y, z]            accel sensor measurements
VectorInt16 aaReal;  // [x, y, z]
VectorInt16 aaWorld; // [x, y, z]
VectorFloat gravity; // [x, y, z]            gravity vector
float euler[3];      // [psi, theta, phi]    Euler angle container
float ypr[3];        // [yaw, pitch, roll]