fadi ladhari
/
Poloytech_Notes
ok
main.cpp
- Committer:
- fadi_lad
- Date:
- 2017-03-09
- Revision:
- 2:500e1c72e56b
- Parent:
- 0:d61dfa687ac8
File content as of revision 2:500e1c72e56b:
//include libraries in cpp file #include "mbed.h" #include "MPU6050.h" //creating an object of serial class //so that we can communicate with PC Serial pc(D8, NC); //setting LED1 to give digital output DigitalOut myled(LED1); DigitalOut out(D0); //creating onject of MPU6050 class MPU6050 ark(PB_9,PB_8); int main() { pc.baud (270000); out=0; ark.setAcceleroRange(MPU6050_ACCELERO_RANGE_8G); ark.setGyroRange(MPU6050_GYRO_RANGE_2000); while(1) { //reading Temprature /*float temp = ark.getTemp(); pc.printf("temprature = %0.2f ^C\r\n",temp); */ //reading Grometer readings int gyro[3]; ark.getGyro(gyro); //reading Acclerometer readings int acce[3]; ark.getAccelero(acce); out=1; pc.printf("U %d %d %d %d %d %d /",ark.getAcceleroRawX(),ark.getAcceleroRawY(),ark.getAcceleroRawZ(),ark.getGyroRawX(),ark.getGyroRawY(),ark.getGyroRawZ()); out=0; //wait(0.01); //wait 1000ms } }